constructor attribute doesn't work in g++ 2.95

Mark E. snowball3@bigfoot.com
Mon Aug 16 10:02:00 GMT 1999


Hi folks,

The constructor attribute doesn't work in the C++ compiler in gcc 2.95 for DJGPP, 
but does in the C compiler. It does work in the C++ compiler in egcs 1.12 for DJGPP. 
The documentation in 2.95 does not mention that the attribute is disabled in g++. 
And ASM_OUTPUT_CONSTRUCTOR is defined in i386/djgpp.h, so that can't be the problem.

When I compile the sample program below as ctor.cpp. No constructor section is 
emitted in gcc 2.95, but is in egcs 1.12. When renamed to ctor.c, the constructor 
section is emitted in both gcc 2.95 and egcs 1.12.

Is there a doc change that I've missed or have I found a bug?

__attribute__ ((constructor))
void init_test (void)
{
  return;
}

int main()
{
  return 0;
}


--- 
Mark Elbrecht, snowball3@bigfoot.com
http://snowball.frogspace.net/


More information about the Gcc-bugs mailing list