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: egcs 10-31 and UnixWare


>   > I don't think it's falling through.  It looks like the problem is that
>   > we're in an atexit() function (__do_global_dtors_aux) and it's calling 
>   > the destructor and the destructor is calling exit.   Since exit() will
>   > rip through the atexit() functions, isn't this bad?
> Hmmm, I don't know enough about the language to know how this is supposed
> to be handled.

I can see this as a grey area.     Can anyone cite definitive sources
for expected behaviour?

>   > /usr/tmp/cca003Pz.s:279:defined relocatable values from the same section re > quired, op -
> Bummer.  I suspect this is the funky way it we switch sections under
> gcc's nose in crtstuff.
> 
> Almost makes we wonder if we should be using section attributes to do
> the switching (which gcc knows how to emit proper debug symbols for).

If this is important, we can move this aspect to another thread.
It was just an annoyance I thought I'd mention.

> But I think you've hit the root of the problem -- it looks like we're
> calling exit more than once, which seems to do bad things.

Yes, and this is why removing HAVE_ATEXIT from my target made
the test case pass becuase we weren't calling exit more than
once.

The attached program does different things on the three systems
I tried it on.

OpenServer 5: $   Calls two.   Calls one.  Calls exit.  Calls abort.
Solaris 2.3:   Calls two.   Calls one.   Terminates normally. Exit val 1.
Redhat 4.1/x86: Calls two.   Calls one.  Calls two.  Call two.  Repeats
	until stack size hits 8Mb ulimit.  Faults.


If we decide that calling exit() from a destructor really is a 
questionable idea, we can just change the test case to call _exit()
instead of exit() in the destructor and we can put HAVE_ATEXIT back
in sco5.h.  

Now exactly how this ties into the Unixware stuff at this point,
I'm unsure...



#include <stdio.h>
#include <stdlib.h>

void one(void)
{
        printf("One\n");
        exit(1);
}

void two(void)
{
        printf("two\n");
}


int main(void)
{
        atexit(one);
        atexit(two);
        exit(1);
}



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