This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16717] New: REGRESSION: __attribute__((constructor)) broken in C++ (optimization level -O2)
- From: "pavenis at latnet dot lv" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jul 2004 16:32:49 -0000
- Subject: [Bug c++/16717] New: REGRESSION: __attribute__((constructor)) broken in C++ (optimization level -O2)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
__attribute__((constructor)) doesn't work in C++ for both gcc-3.4.1 and
gcc-3.5.0 20040725 when optimization level -O2 is being used.
All seems to work Ok with gcc-3.3.4.
-------------------- bug.cc ----------------------
#include <stdio.h>
void hello (void) __attribute__ ((constructor));
void hello (void) { printf ("Hello world\n"); }
int main (void) { return 0; }
---------------------------------------------------
g++ -O2 bug.cc -o bug
./bug
works with gcc-3.3.4, but not with gcc-3.4.1 and 3.5.0 20040725
(Initially bug were reported for target i586-pc-msdosdjgpp)
--
Summary: REGRESSION: __attribute__((constructor)) broken in C++
(optimization level -O2)
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pavenis at latnet dot lv
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16717