This is the mail archive of the gcc@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]

init_priority(65535) vs constructor/destructor


With the latest snapshot, when trying to mix the attributes
init_priority(65536) and constructor in the same file you'll get an error:

$ cat ctor.cc
void __attribute__ ((constructor)) init (void) {}
struct X { X (); };
X foo __attribute__ ((init_priority (65535)));
int main () { return 0; }
$ g++ -c ctor.cc
ctor.cc: In function `(static initializers for ctor.cc)':
ctor.cc:4: redefinition of `(static initializers for ctor.cc)'
ctor.cc:4: `(static initializers for ctor.cc)' previously defined here

And when modifying the example slightly by removing the constructor from X
the compiler crashes:

$ cat ctor2.cc
void __attribute__ ((constructor)) init (void) {}
struct X { };
X foo __attribute__ ((init_priority (65535)));
int main () { return 0; }
$ g++ -c ctor2.cc
ctor2.cc:4: Internal compiler error.
ctor2.cc:4: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
ctor2.cc:4: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org


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