summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-pr38236.c
blob: 554026b1ce4be6175e8485603905ad9e6a233a8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
   pr15262.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

struct X { int i; };

int
foo (struct X *p, int *q, int a, int b)
{
  struct X x, y;
  if (a)
    p = &x;
  if (b)
    q = &x.i;
  else
    q = &y.i;
  *q = 1;
  return p->i; 
}

void
testTortureExecute (void)
{
  if (foo((void *)0, (void *)0, 1, 1) != 1)
    ASSERT (0);
  return;
}