[Bug target/83133] Superflous x86 test instructions in generated assembly.
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 24 17:06:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83133
--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to joseph@codesourcery.com from comment #5)
> Both 32-bit and 64-bit ABIs make the values of flags in EFLAGS (other than
> DF) undefined on function entry and return. Thus, a function can never
> assume anything about the value of OF unless it has executed an
> instruction known to set/clear it and has not called any other functions
> since then.
In the testcase, there is nothing that violates ABI. It all happens in "g" that
passes calculated result to a function. Selected function depends on flags,
calculated from the subtraction, and wrong function gets selected when overflow
happens.
More information about the Gcc-bugs
mailing list