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

optimization/4382: __builtin_{set,long}jmp with -O3 can crash the compiler



>Number:         4382
>Category:       optimization
>Synopsis:       __builtin_{set,long}jmp with -O3 can crash the compiler
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 24 04:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Michal Moskal <malekith@pld.org.pl>
>Release:        20010917 snapshot, gcc 3.0.1
>Organization:
>Environment:
PLD Linux/GNU on ia32, possibly other ia32, don't crash
axp-pld-linux
>Description:
I guess there are some problems with inlaingin function and
non-local gotos. I found it during Ksi developments, but
it also crashes C compiler. However as 
__bultin_{set,long}jmp are not documented, and in sources
there are comments, not to use them other way then
Ada and sjlj exception, so I'm not sure if code below
is legal. However, this seems to be a problem.
>How-To-Repeat:
compile following with -O3 (-fno-inline removes problem):

#v+
struct jmp_buf {
        void *p[5];
};

static void jumpaway(struct jmp_buf *ptr)
{
        __builtin_longjmp(ptr ,1);
        abort();
}

int main(void)
{
        struct jmp_buf buf;

        if (__builtin_setjmp(&buf) == 0) {
        } else
                return 0;
        jumpaway(&buf);
        abort();
        return 0;
}
#v-
>Fix:
none know, beside -fno-inline...
>Release-Note:
>Audit-Trail:
>Unformatted:


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