http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58034
Bug ID: 58034 Summary: glibc nptl/tst-cleanup2 fail due to scheduling Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: amodra at gmail dot com Created attachment 30575 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30575&action=edit preprocessed test case nprl/tst-cleanup2 fails when compiled with -O2 -mcpu=power6 due to sched1 moving an assignment to a REG over code that traps. The relevant test case source: if (setjmp (jmpbuf)) { puts ("Exiting main..."); return 0; } sprintf (p, "This should segv\n"); return 1; } The sprintf is optimised to three loads and stores. The problem occurs due to the assignment of 1 to the REG holding the function return value being scheduled before the sprintf expansion.