http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46850
Summary: optimization of inline function leads to incorrect integer comparison result Product: gcc Version: 4.4.5 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: brad.k...@kitware.com Created attachment 22686 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22686 Bash script to reproduce bug The output of the attached script is expected to be "0" but is "1". Tested on GCC 4.4.5, Linux x86_64, but I believe it occurs elsewhere too and in other versions. At first I encountered the problem with -O2 but then narrowed it down to -O -fstrict-overflow -foptimize-sibling-calls -ftree-vrp as shown in the script. Adding -fno-guess-branch-probability fixes the problem. Removing "inline" from the function fixes the problem.