blob: 443d8248682a6f76f783f93251600b3ecc677cf4 (
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
|
/*
20080604-1.c from the execute part of the gcc torture tests.
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_c99
#endif
struct barstruct { char const* some_string; } x;
void
foo(void)
{
if (!x.some_string)
ASSERT (0);
}
void baz(int b)
{
struct barstruct bar;
struct barstruct* barptr;
if (b)
barptr = &bar;
else
{
barptr = &x + 1;
barptr = barptr - 1;
}
barptr->some_string = "Everything OK";
foo();
barptr->some_string = "Everything OK";
}
void
testTortureExecute (void)
{
x.some_string = (void *)0;
baz(0);
if (!x.some_string)
ASSERT (0);
return;
}
|