Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20050125-1.c
blob1ca1a9a4bb18fc341d37fa4582cf661210ce0036
1 /*
2 20050125-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* Verify that the CALL side effect isn't optimized away. */
12 /* Contributed by Greg Parker 25 Jan 2005 <gparker@apple.com> */
14 #include <stdlib.h>
15 #include <stdio.h>
17 struct parse {
18 char *next;
19 char *end;
20 int error;
23 int seterr(struct parse *p, int err)
25 p->error = err;
26 return 0;
29 void bracket_empty(struct parse *p)
31 if (((p->next < p->end) && (*p->next++) == ']') || seterr(p, 7)) { }
34 void testTortureExecute(void)
36 struct parse p;
37 char x;
38 p.next = p.end = &x;
40 p.error = 0;
41 bracket_empty(&p);
42 if (p.error != 7)
43 ASSERT (0);
45 return;