[llvm-bugs] [Bug 41865] New: [ms] #pragma bss_seg fails to apply to globals with user provided constructors

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 13 13:13:54 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190513/45f5e511/attachment-0001.html>


More information about the llvm-bugs mailing list