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.