This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50865] Invalid code generation for INT64_MIN % 1 on x86_64
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Oct 2011 15:52:38 +0000
- Subject: [Bug c/50865] Invalid code generation for INT64_MIN % 1 on x86_64
- Auto-submitted: auto-generated
- References: <bug-50865-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50865
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-10-25 15:52:38 UTC ---
On Tue, 25 Oct 2011, jaak.randmets at cyber dot ee wrote:
> > What do you think is wrong? C1X makes explicit what was intended before
> > then: that both a/b and a%b have undefined behavior if the quotient is not
> > representable. (See bug 30484 for more discussion; the only bug is that
> > with -fwrapv this should reliably give 0.)
>
> In all 4 cases the quotient is representable and should evaluate to the result
> of "INT64_MIN % 1".
The quotient is INT64_MIN / 1, which is one greater than INT64_MAX and is
not representable.