This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/50066] [4.7 Regression] Bad signed int to unsigned long long conversion
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 13 Aug 2011 14:27:58 +0000
- Subject: [Bug middle-end/50066] [4.7 Regression] Bad signed int to unsigned long long conversion
- Auto-submitted: auto-generated
- References: <bug-50066-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50066
--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2011-08-13 14:27:58 UTC ---
Does this patch
---
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index df7a9a2..f5e0a30 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -2065,6 +2065,12 @@ vrp_int_const_binop (enum tree_code code, tree val1,
tree
val2)
&& is_overflow_infinity (val2))
return NULL_TREE;
+ /* Punt integer subtraction with overflow on -MIN. */
+ if (code == MINUS_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (res))
+ && (sgn1 < 0 || sgn2 < 0))
+ return NULL_TREE;
+
/* Don't try to handle division or shifting of infinities. */
if ((code == TRUNC_DIV_EXPR
|| code == FLOOR_DIV_EXPR
---
make any senses?