Back to index

glibc  2.9
Defines | Functions | Variables
bug269-setjmp.c File Reference
#include <stdio.h>
#include <setjmp.h>
#include <stdlib.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

int f (void)
static int do_test (void)

Variables

jmp_buf buf1
jmp_buf buf2
intp
int n_x = 6
static int g_counter = 0

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 106 of file bug269-setjmp.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 92 of file bug269-setjmp.c.

{
  int lose;

  lose = f ();

  if (lose)
    puts ("Test FAILED!");
  else
    puts ("Test succeeded!");

  return lose ? EXIT_FAILURE : EXIT_SUCCESS;
}

Here is the call graph for this function:

int f ( void  )

Definition at line 33 of file bug269-setjmp.c.

{
  static int counter = 0;
  static int way_point1 = 3;
  static int way_point2 = 2;
  int lose = 0;

  if (setjmp (buf1) != 101)
    {
      int a[n_x];           /* reallocate stack space */
      g_counter++;
      p = &a[0];
      if (g_counter < 5)
       longjmp (buf1, 2);
      else if (g_counter == 5)
       longjmp (buf1, 101);
      else
       {
         _setjmp (buf2);
         _longjmp (buf1, 101);
       }
    }

  way_point1--;

  if (counter == 0)
    {
      counter++;
      {
       int a[n_x];          /* reallocate stack space */
       g_counter++;
       p = &a[0];
       if (g_counter < 5)
         longjmp (buf1, 2);
       else if (g_counter == 5)
         longjmp (buf1, 101);
       else
         {
           _setjmp (buf2);
           _longjmp (buf1, 101);
         }
      }
    }

  way_point2--;

  if (counter == 1)
    {
      counter++;
      longjmp (buf2, 2);
    }

  lose = !(way_point1 == 0 && way_point2 == 0
          && g_counter == 6 && counter == 2);

  return lose;
}

Here is the call graph for this function:


Variable Documentation

jmp_buf buf1

Definition at line 17 of file bug269-setjmp.c.

jmp_buf buf2

Definition at line 26 of file bug269-setjmp.c.

int g_counter = 0 [static]

Definition at line 30 of file bug269-setjmp.c.

int n_x = 6

Definition at line 28 of file bug269-setjmp.c.

int* p

Definition at line 27 of file bug269-setjmp.c.