This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/67040] New: gcc-5.2 fails with flat namespaces on the mac os
- From: "balaji at anl dot gov" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Jul 2015 05:13:20 +0000
- Subject: [Bug c/67040] New: gcc-5.2 fails with flat namespaces on the mac os
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67040
Bug ID: 67040
Summary: gcc-5.2 fails with flat namespaces on the mac os
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: balaji at anl dot gov
Target Milestone: ---
gcc-5.2 causes bad library builds on the mac os, when built with flat
namespaces, and with no optimizations.
The following simple program reproduces the problem:
{{{
% cat foo.c
#include <stdio.h>
void bar(void) { }
void foo(void *s) { bar(); }
}}}
{{{
% cat test.c
#include <stdio.h>
void foo(void *s);
int main()
{
foo(NULL);
return 0;
}
}}}
{{{
% gcc -dynamiclib foo.c -o libfoo.dylib -Wl,-flat_namespace
% gcc -L. test.c -lfoo
% ./a.out
Segmentation fault: 11
}}}
Either removing the `-Wl,-flat_namespace` option or adding some level of
optimization, such as `-O2` to the library build fixes this issue.