While looking into the failure of gcc.c-torture/compile/20050113-1.c on mipsisa32-elf, I noticed the tree-outof-ssa can move potentially- trapping operations across what were sequence points, even when compiled with -fnon-call-exceptions. E.g., consider the following C++ code, compiled with -fnon-call-exceptions:
------------------------------------------------------------------------ #include <stdio.h> void foo (int) { printf ("Bar\n"); } int main (void) { int a = 1 / 0; printf ("Foo\n"); foo (a); } ------------------------------------------------------------------------ The tree optimisers themselves preserve the intent of the code, but tree-outof-ssa.c propogates the division into the call to foo(): ------------------------------------------------------------------------ int main() () { <bb 2>: __builtin_puts (&"Foo"[0]); foo (1 / 0); return 0; } ------------------------------------------------------------------------ So the unoptimised program behaves as expected, raising the divide-by-zero trap before printing "Foo". The optimised version prints "Foo" first. Is this a known problem? (I tried to find it in bugzilla, but couldn't) Richard