[llvm-bugs] [Bug 37642] New: clang with -O0 doesn't generate a section on static variable.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 31 07:20:38 PDT 2018


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

            Bug ID: 37642
           Summary: clang with -O0 doesn't generate a section on static
                    variable.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zahira.ammarguellat at intel.com
                CC: llvm-bugs at lists.llvm.org

test.c:
 static int foo __attribute__((section("bar"))) = 3;
 int main(){
  return foo;
 }

When compiled with -O0 and gcc720 : section bar is generated in object code.
When compiled with -O0 and clang: no section bar is generated in object.

At -O2 both gcc and clang have the same behavior (section generated and
optimized away).

At O0 a section should be generated, the same way than gcc.

-- 
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/20180531/ce180fd1/attachment.html>


More information about the llvm-bugs mailing list