This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][RFC] Fix PR30364, reassociation not allowed for undefined overflow


On 6/22/07, Rask Ingemann Lambertsen <rask@sygehus.dk> wrote:
On Sat, Feb 24, 2007 at 10:58:41PM +0100, Richard Guenther wrote:
>
> 2007-02-21  Richard Guenther  <rguenther@suse.de>
>
>       PR middle-end/30364
>       * fold-const.c (fold_binary): Do not associate expressions
>       with more than one variable for integer types that do not wrap.
>
>       * gcc.dg/torture/pr30364-1.c: New testcase.
>       * gcc.dg/torture/pr30364-2.c: Likewise.
>       * gcc.dg/torture/pr30364-3.c: Likewise.
>
> Index: testsuite/gcc.dg/torture/pr30364-1.c
> ===================================================================
> *** testsuite/gcc.dg/torture/pr30364-1.c      (revision 0)
> --- testsuite/gcc.dg/torture/pr30364-1.c      (revision 0)
> ***************
> *** 0 ****
> --- 1,19 ----
> + /* { dg-do run } */
> +
> + extern void abort (void);
> +
> + int f(int a, int b)
> + {
> +   if (a > 0x7FFFFFF0) return 0;
> +   if (b > 0x7FFFFFF0) return 0;
> +
> +   int c = (a - 20) + (b - 20);
> +   return c > 0x7FFFFFF0;
> + }
> +
> + int main()
> + {
> +   if (f (0x7FFFFFF0, 41) != 1)
> +     abort ();
> +   return 0;
> + }

1) This tests nothing on hosts where int is 64 bits.

Which would be?


2) This will always fail on hosts where int is 16 bits.

Do they all have SImode? In which case we could use a SImode type. Feel free to do so or file a bugreport to remind me (you can assign it to me).

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]