This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: trivial rs6000 fix
- From: Richard Sandiford <richard at codesourcery dot com>
- To: Stuart Hastings <stuart at apple dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Jul 2006 11:23:17 +0100
- Subject: Re: trivial rs6000 fix
- References: <B64B7AE8-6E3C-4363-AEF8-B23349954AF9@apple.com>
Stuart Hastings <stuart@apple.com> writes:
> -#define SMALL_INT(X) ((unsigned) (INTVAL (X) + 0x8000) < 0x10000)
> +#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000)
One thing that's been bugging me for a while: now that gcc's optimisers
are being more aggressive in using the undefinedness of signed overflow,
should we be more careful about adding signed HOST_WIDE_INTs like this?
Not a comment about this patch specifically -- the same construct is
used all over the place, and it's unlikely that a simple test like this
would get screwed up. I just thought I'd point it out because (a) I think
we need a new function or macro to make these kinds of test and (b) the
"right thing" is actually two characters shorter:
#define SMALL_INT(X) ((unsigned HOST_WIDE_INT) INTVAL (X) + 0x8000 < 0x10000)
Richard