[Bug c++/50560] New: g++ optimization -O3 is removing symbols from templates
marktrinh.junk at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Sep 28 18:27:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50560
Bug #: 50560
Summary: g++ optimization -O3 is removing symbols from
templates
Classification: Unclassified
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: marktrinh.junk@gmail.com
Created attachment 25377
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25377
sample source files to reproduce the problem
gcc 4.5.1:
When compiling/linking my sample library, it seems that the optimization level
-O3 is not finding symbols where -O2 & -O1 works just fine.
make
g++ -g -fPIC -Wall -O3 -c -o bug_Option.o bug_Option.cpp
g++ -g -fPIC -Wall -O3 -c -o UseOption.o UseOption.cpp
g++ -g -shared -Wl,-z,defs -g -shared -o libOption.so bug_Option.o UseOption.o
UseOption.o: In function `foo()':
/tmp/bug/UseOption.cpp:4: undefined reference to
`Option<std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>::Option()'
collect2: ld returned 1 exit status
make: *** [libOption.so] Error 1
I've attached my code.
change the GNUmakefile CXXFLAGS to -O2 to see it work.
More information about the Gcc-bugs
mailing list