[Bug tree-optimization/50865] Invalid code generation for INT64_MIN % 1 on x86_64
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Tue Oct 25 17:14:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50865
--- Comment #10 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-10-25 17:13:51 UTC ---
On Tue, 25 Oct 2011, jaak at ristioja dot ee wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50865
>
> --- Comment #9 from Jaak Ristioja <jaak at ristioja dot ee> 2011-10-25 16:37:48 UTC ---
> (In reply to comment #8)
> > Well, they are equivalent where they are both defined, or if you apply C99
> > rules to infinite-precision integers. The problem here is that INT_MIN %
> > -1 is undefined (explicitly in C1X) and so a transformation of INT_MIN % 1
> > into INT_MIN % -1 is unsafe (the other way round, transforming undefined
> > behavior to defined, is fine at least in the absence of -ftrapv).
>
> But INT_MIN % 1 is still defined to be zero?
Yes. INT_MIN % 1 is defined to be zero, since the infinite-precision
values of both INT_MIN / 1 and INT_MIN % 1 are representable. INT_MIN %
-1 is undefined because the infinite-precision value of INT_MIN / -1 is
not representable in int.
More information about the Gcc-bugs
mailing list