summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-950426-1.c
blob: e3f69e855beed767e63a4074f1080c424fbd976a (plain) (blame)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
   950426-1.c from the execute part of the gcc torture suite.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#pragma disable_warning 85
#pragma disable_warning 196
#endif

#include <string.h>

struct tag {
  int m1;
  char *m2[5];
} s1, *p1;

int i;

int func1(int *p);

void foo (char *s);

void
testTortureExecute (void)
{
  s1.m1 = -1;
  p1 = &s1;

  if ( func1( &p1->m1 ) == -1 )
    foo ("ok");
  else
    ASSERT (0);

  i = 3;
  s1.m2[3]= "123";

  if ( strlen( (p1->m2[i])++ ) == 3 )
    foo ("ok");
  else
    ASSERT (0);

  return;
}

int func1(int *p) { return(*p); }

void foo (char *s) {}