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

            Bug ID: 41865
           Summary: [ms] #pragma bss_seg fails to apply to globals with
                    user provided constructors
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: r...@google.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

Consider:

$ cat t.cpp
struct Foo {
  int x, y;
  Foo() : x(1), y(2) {}
};
#pragma bss_seg("my_bss")
Foo gv;

$ cl -c t.cpp  && dumpbin t.obj | grep bss
Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27508.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

t.cpp
           8 my_bss

$ clang-cl -c t.cpp  && dumpbin t.obj | grep bss
           8 .bss

Clang thinks `gv` has an initializer, so it would apply the most recently
active data_seg pragma, instead of bss_seg. The code to control this is here:
https://github.com/llvm/llvm-project/blob/master/clang/lib/Sema/SemaDecl.cpp#L11926

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

Reply via email to