https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70214
Bug ID: 70214 Summary: external call is not considered a barrier Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: stsp at users dot sourceforge.net Target Milestone: --- Created attachment 37948 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37948&action=edit a test case The attached test-case prints "1" when compiled with -O0, and "0" when compiled with -O1. I checked with clang - always "1", no matter what optimization level is. The bug is that gcc seems to no longer consider the external function call (pthread_kill() in this case) as an optimization barrier.