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 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.
   2) This will always fail on hosts where int is 16 bits.

Likewise for the other two tests. Examples of failures on 16-bit hosts are
in the gcc-testresult archives.
http://gcc.gnu.org/cgi-bin/search.cgi?form=extended&m=all&q=pr30364&ul=/ml/gcc-testresults/2007-03/%25&wm=wrd&s=DRP

-- 
Rask Ingemann Lambertsen


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