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]

[PATCH] Fix PR37078


This fixes an ICE with a corner-case in VRP.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the trunk.

Richard.

2008-08-22  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/37078
	* tree-vrp.c (extract_range_from_unary_expr): Avoid generating
	[+INF, +INF] ranges.

	* gcc.c-torture/compile/pr37078.c: New testcase.

Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c	(revision 139496)
--- gcc/tree-vrp.c	(working copy)
*************** extract_range_from_unary_expr (value_ran
*** 2707,2713 ****
  	max = fold_unary_to_constant (code, type, vr0.max);
        else if (!needs_overflow_infinity (type))
  	max = TYPE_MAX_VALUE (type);
!       else if (supports_overflow_infinity (type))
  	max = positive_overflow_infinity (type);
        else
  	{
--- 2707,2716 ----
  	max = fold_unary_to_constant (code, type, vr0.max);
        else if (!needs_overflow_infinity (type))
  	max = TYPE_MAX_VALUE (type);
!       else if (supports_overflow_infinity (type)
! 	       /* We shouldn't generate [+INF, +INF] as set_value_range
! 		  doesn't like this and ICEs.  */
! 	       && !is_positive_overflow_infinity (min))
  	max = positive_overflow_infinity (type);
        else
  	{
Index: gcc/testsuite/gcc.c-torture/compile/pr37078.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/pr37078.c	(revision 0)
--- gcc/testsuite/gcc.c-torture/compile/pr37078.c	(revision 0)
***************
*** 0 ****
--- 1,6 ----
+ int foo (int b)
+ {
+   if (b == (int)0x80000000)
+     return __builtin_abs (b);
+   return 0;
+ }


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