This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/86181] New: static object mangling conflicts
- From: "zhonghao at pku dot org.cn" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 17 Jun 2018 01:11:54 +0000
- Subject: [Bug c++/86181] New: static object mangling conflicts
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86181
Bug ID: 86181
Summary: static object mangling conflicts
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zhonghao at pku dot org.cn
Target Milestone: ---
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
The gcc report has a long discussion on this issue. Perhaps, the bug is not
fully fixed?