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

            Bug ID: 37885
           Summary: static object mangling conflicts
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

I found that gcc+ produces errors when it compiles the following code:
extern "C" void abort();
static int i;
int *p = &i;
int main()
{ 
 int i;
 { 
 extern int i;
 i = 1;
 *p = 2;
 if (i == 2)
 abort ();
 }
 return 0;
}

When compiling the above code, clang++ does not produce any errors. The code
comes from https://bugs.llvm.org/show_bug.cgi?id=5966

Indeed, the situation is more complicated. The above bug report of clang says
that the code comes from a bug report of gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775

I reported the difference to gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86181

After reading the bug report, Richard Biener made the following comment: "I
think the clang bug is incomplete and misses the 2nd TU which defines i.  So
GCC works (and the testcase is in the testsuite)."

Is this a recurring bug in clang? Hope that the comment from Richard Biener can
further improve clang.

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

Reply via email to