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



--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-17 
09:57:52 UTC ---

Created attachment 29889

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29889

patch



Untested patch.  The patch handles setjmp similar to a non-local label,

thus force it to start a new basic-block and get abnormal edges from all

sites that can make a non-local goto or call longjmp.



Fixes the testcase for me.  Somewhat reduced:



#include <stdio.h>

#include <stdlib.h>

#include <setjmp.h>



static sigjmp_buf env;



static inline int g(int x)

{

    if (x)

    {

        fprintf(stderr, "Returning 0\n");

        return 0;

    }

    else

    {

        fprintf(stderr, "Returning 1\n");

        return 1;

    }

}



int f(int *e)

{

    if (*e)

      return 1;



    int x = setjmp(env);

    int n = g(x);

    if (n == 0)

      exit(0);

    if (x)

      abort();

    longjmp(env, 42);

}



int main(int argc, char** argv)

{

    int v = 0;

    return f(&v);

}



but I cannot remove the remaining printfs, so it's not appropriate for the

testsuite yet.

Reply via email to