1/* Checks that pure functions are not treated as const. */ 2 3char *p; 4 5static int __attribute__ ((pure)) 6is_end_of_statement (void) 7{ 8 return *p == '\n' || *p == ';' || *p == '!'; 9} 10 11void foo (void) 12{ 13 /* The is_end_of_statement call was moved out of the loop at one stage, 14 resulting in an endless loop. */ 15 while (!is_end_of_statement ()) 16 p++; 17} 18 19int 20main (void) 21{ 22 p = "abc\n"; 23 foo (); 24 return 0; 25} 26