This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/22215] New: g++ -O2 generates Undefined Global for statically defined function
- From: "ysato at delegate dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jun 2005 10:39:01 -0000
- Subject: [Bug c++/22215] New: g++ -O2 generates Undefined Global for statically defined function
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
/* g++ -O2 puts Undefined Global reference for statically defined function */
char *v;
static int server1(){ return 0; }
void func(){ (v?v:(v=0))[server1()]; }
Save the above into "n.c" and compile it with "g++ -O2 -c n.c", then the
"n.o" includes "Undefined Global __Z7server1v" for statically defined
function "server1()". I saw this problem in g++ 3.4.2 and 3.4.4.
In other versions, the function is expanded inline by default.
--
Summary: g++ -O2 generates Undefined Global for statically
defined function
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ysato at delegate dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22215