[Bug c++/86181] New: static object mangling conflicts
zhonghao at pku dot org.cn
gcc-bugzilla@gcc.gnu.org
Sun Jun 17 01:12:00 GMT 2018
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?
More information about the Gcc-bugs
mailing list