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-loop-12.c
blob021284b1a163f295cbe0a940e9ff210e2bcc4d63
1 /*
2 loop-12.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
12 /* Checks that pure functions are not treated as const. */
14 const char *p;
16 static int
17 is_end_of_statement (void)
19 return *p == '\n' || *p == ';' || *p == '!';
22 void foo (void)
24 /* The is_end_of_statement call was moved out of the loop at one stage,
25 resulting in an endless loop. */
26 while (!is_end_of_statement ())
27 p++;
30 void
31 testTortureExecute (void)
33 p = "abc\n";
34 foo ();
35 return;