public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR37078
@ 2008-08-22 21:52 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2008-08-22 21:52 UTC (permalink / raw)
  To: gcc-patches


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;
+ }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-22 20:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-22 21:52 [PATCH] Fix PR37078 Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).