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]

Re: p2736.C Is dtor order guaranteed?


> > This target calls both constructors and both destructors.  It, however,
> > doesn't do them in the order that this testcase likes.
> 
> The requirement is that destructors must be called in reverse order of
> construction.  

Thanx for the clarifcation.

For ELF, it does exactly the LIFO you describe:

$ ./xgcc -melf  -B./ /tmp/p.C && ./a.out ; echo $?
ctor 804c444
ctor 804dac0
dtor 804dac0
dtor 804c444
0

For COFF, the order is not reversed:

$ ./xgcc -mcoff  -B./ /tmp/p.C && ./a.out ; echo $?
ctor 4003f4
ctor 403c9c
dtor 4003f4
Count 1 which 2
dtor 403c9c
Count 2 which 1
Abort(coredump)
134



> Anyway, the testcase g++.other/init5.C does a better
> job of testing this feature, so p2736.C may even be dropped.  Does
> init5.C work on the port you're working on?

init5.C is XFAILed on all targets so it never shows up in the testsuite
as a failure.  If I manually run it, it aborts on both COFF and ELF.

RJL


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