This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11530] New: inline static function not emitted with -O3
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jul 2003 21:19:10 -0000
- Subject: [Bug c++/11530] New: inline static function not emitted with -O3
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11530
Summary: inline static function not emitted with -O3
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: snyder at fnal dot gov
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
For the program below, g++ 3.4 does not emit code for RunState::runcallback,
if compiled with -O3:
$ g++ -O3 -o x x.cc
/tmp/cc4LLDSK.o: In function `main':
/tmp/cc4LLDSK.o(.text+0x1a): undefined reference to `RunState::runcallback()'
collect2: ld returned 1 exit status
$
$ g++ -c -O3 x.cc
$ nm -Bo x.o
x.o:00000000 T _Z1aPFvvE
x.o: U _ZN8RunState11runcallbackEv
x.o: U __gxx_personality_v0
x.o:00000010 T main
$
Environment:
System: Linux karma 2.4.19-emp_2419p5a829i #1 Tue Sep 3 17:42:17 EST 2002 i686 i686 i386 GNU/Linux
Architecture: i686
<machine, os, target, libraries (multiple lines)>
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77 : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured)
How-To-Repeat:
Compile with -O3:
-----------------------------------------------------------------
void a (void (*f)())
{
f();
}
struct RunState
{
static void runcallback() { }
static void wait()
{
a (runcallback);
}
};
int main()
{
RunState::wait();
return 0;
}
-----------------------------------------------------------------
------- Additional Comments From snyder at fnal dot gov 2003-07-15 21:19 -------
Fix:
<how to correct or work around the problem, if known (multiple lines)>