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]
Other format: [Raw text]

[Bug c/15996] New: __builtin_longjmp just after another __builtin_longjmp fails with null dereferencing


I use just built snapshot of gcc 3.5.0 20040613, built on Red Hat Enterprise
Linux AS release 3 (Taroon Update 2) with i686 architecture, configured with
--prefix=/home/shared_storage/gcc_sources/gcc-bin/ia32 --disable-libgcj
--disable-libada.

Compiling the following test case:
#include <stdio.h>
#include <setjmp.h>

jmp_buf env[2];

#define TRACE(x) printf("Doing longjmp %d\n", x);

int main()
{
    if (!__builtin_setjmp(env[0])) {
        if (!__builtin_setjmp(env[1])) {
            TRACE(1);
            __builtin_longjmp(env[1], 1);
        }
        TRACE(0);
        __builtin_longjmp(env[0], 1);
    }
    return 0;
}

newest gcc produces (command line `gcc test.c`) the code that fails with
segmentation fault doing the second longjmp:
Doing longjmp 1
Segmentation fault

gcc 3.2 installed in the system produces correct code:
Doing longjmp 1
Doing longjmp 0

The preprocessed file test.i is attached if you need.

-- 
           Summary: __builtin_longjmp just after another __builtin_longjmp
                    fails with null dereferencing
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Vyatcheslav dot Sysoltsev at intel dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: 3.5.0 20040613
  GCC host triplet: i686
GCC target triplet: i686


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15996


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