https://bugs.llvm.org/show_bug.cgi?id=41776

            Bug ID: 41776
           Summary: Using __attribute__((weak,dllimport)) results in clang
                    generating invalid IR
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Consder:

int __attribute__((weak, dllimport)) my_weak(int x); // { return x; }
int main() {
  if (my_weak)
    my_weak(0);
  return 13;
}

$ clang -cc1 -triple x86_64-windows-msvc t.c -S -o t.s
Global is marked as dllimport, but not external
i32 (i32)* @my_weak
fatal error: error in backend: Broken module found, compilation aborted!
Stack dump:
0.      Program arguments: C:\src\llvm-project\build\bin\clang.exe -cc1 -triple
x86_64-windows-msvc t.c -S -o t.s
1.      <eof> parser at end of file
2.      Per-function optimization

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to