This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for incorrect execute/divconst-2.c
- To: Jeffrey A Law <law at cygnus dot com>
- Subject: Re: Patch for incorrect execute/divconst-2.c
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- Date: Tue, 14 Mar 2000 20:48:05 -0500 (EST)
- cc: gcc-patches at gcc dot gnu dot org
On Tue, 14 Mar 2000, Jeffrey A Law wrote:
> In message <Pine.BSF.4.10.10003110755460.17527-100000@dair.pair.com>you write
> > Unfortunately this uncovers other GCC problems: the "quot * -2147483648"
> > gets optimized into "quot << 31" on a host with 32-bit HOST_WIDE_INTs,
> > regardless of sizeof long on the actual target,
> When precisely is that not a safe thing to do?
When "long int" (the type of quot) is 64 bits on the target.
It is then wrong since -2147483648L != (1 << 31).
The correct optimization would then be -(quot) << 31.
> > Should I commit this, or break some more stuff? :-)
> > Perhaps I should remove the ABS check, so it doesn't break on ix86-* self?
> Given that abs (-MAXINT) is undefined, that check should probably be removed.
Ok. For a machine with 64-bit longs it is valid, though.
> The rest of the changes seem quite reasonable.
Thanks. I take that as an "ok", and will install it in the next few days
with the ABS check in the patch replaced by this (somewhat sheepish)
comment:
/* For completeness, a check for "ABS (rem) < ABS (denom)" belongs here,
but causes trouble on 32-bit machines and isn't worthwhile. */
brgds, H-P