This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16717] New: REGRESSION: __attribute__((constructor)) broken in C++ (optimization level -O2)


__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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]