This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: failure to construct global object
> I have attached bzipped .ii and the .s for the following program:
Thanks for the update. I've analysed the .s file, and it looks alright
to me. Please try to follow it to some degree:
There is a function _GLOBAL_.I.main, which will be called 'magically'
when the program starts. You can see it puts 65535 and 1 on the stack,
and then calls __static_initialization_and_destruction_0.
Inside this function, it checks whether ebp+12 is 65535 (it is), and
whether ebp+8 is 0 (it is not). So it continues at label LM181. Are
you still with me?
There it, pushes AsComplex_zero on the stack (and a number of zeroes),
and invokes cAsComplex::cAsComplex(double, double), to construct that.
Afterwards, it puts offender onto the stack, and invokes
cAsSystem::cAsSystem(void), to construct that.
So if we are getting until here, all works as designed.
To find out if it works, and if not why not, I'd ask you to perform
the following investigations:
Please report the exact command line you are using to link the
application, including the detailed compiler and linker output. To do
so, add '-v -Wl,--verbose' to the line linking the executable, and
send the resulting output (including the line you've invoked
yourself).
Next, please run the application in a debugger. Set a breakpoint on
_GLOBAL_.I.main (you might have to put this in quotes for gdb to
understand it). Also, set a breakpoint on cAsSystem::cAsSystem(void)
(again, in quotes), and on main. Run the program, and report which
breakpoints are hit in which order.
Thanks,
Martin