aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-09-09 10:05:49 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-09-09 10:05:49 +0000
commit6e548df501d6447f40d294f8fc01b7d8f3b72887 (patch)
treedfe54048f3cb5947e6b5139fc262812481df1e33 /gcc
parent18b0679f097a3656acf82ebbb7a703bd4c0bb174 (diff)
downloadgcc-6e548df501d6447f40d294f8fc01b7d8f3b72887.zip
gcc-6e548df501d6447f40d294f8fc01b7d8f3b72887.tar.gz
gcc-6e548df501d6447f40d294f8fc01b7d8f3b72887.tar.bz2
re PR tree-optimization/37387 (ICE in extract_range_from_binary_expr, at tree-vrp.c:2145)
2008-09-09 Richard Guenther <rguenther@suse.de> PR tree-optimization/37387 * tree-ssa-ifcombine.c (ifcombine_iforif): Convert the name and bits to a common type. * gcc.c-torture/compile/pr37387.c: New testcase. From-SVN: r140142
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37387.c11
-rw-r--r--gcc/tree-ssa-ifcombine.c19
4 files changed, 41 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 480ee53..c7848ff 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-09 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/37387
+ * tree-ssa-ifcombine.c (ifcombine_iforif): Convert the name
+ and bits to a common type.
+
2008-09-09 Nick Clifton <nickc@redhat.com>
* config/v850/v850.md (return): Restore frame size restriction.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 02f9112..c83bb25 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-09 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/37387
+ * gcc.c-torture/compile/pr37387.c: New testcase.
+
2008-09-09 Daniel Kraft <d@domob.eu>
PR fortran/37411
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37387.c b/gcc/testsuite/gcc.c-torture/compile/pr37387.c
new file mode 100644
index 0000000..d338933
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37387.c
@@ -0,0 +1,11 @@
+typedef long int Int;
+void FuncMakeConsequencesPres (long *objDefs1)
+{
+ long a = (long)objDefs1;
+ int c = a & 0x01;
+ int b = 0;
+ if (! ( 13 <= ( c ? 0 : (((int) objDefs1 & 0x02) ? 0 : *objDefs1 ))
+ && b <= 0))
+ ErrorQuit ();
+}
+
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index a4a74ee..eedeb62 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -440,6 +440,25 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb)
else
return false;
+ /* As we strip non-widening conversions in finding a common
+ name that is tested make sure to end up with an integral
+ type for building the bit operations. */
+ if (TYPE_PRECISION (TREE_TYPE (bits1))
+ >= TYPE_PRECISION (TREE_TYPE (bits2)))
+ {
+ bits1 = fold_convert (unsigned_type_for (TREE_TYPE (bits1)), bits1);
+ name1 = fold_convert (TREE_TYPE (bits1), name1);
+ bits2 = fold_convert (unsigned_type_for (TREE_TYPE (bits2)), bits2);
+ bits2 = fold_convert (TREE_TYPE (bits1), bits2);
+ }
+ else
+ {
+ bits2 = fold_convert (unsigned_type_for (TREE_TYPE (bits2)), bits2);
+ name1 = fold_convert (TREE_TYPE (bits2), name1);
+ bits1 = fold_convert (unsigned_type_for (TREE_TYPE (bits1)), bits1);
+ bits1 = fold_convert (TREE_TYPE (bits2), bits1);
+ }
+
/* Do it. */
gsi = gsi_for_stmt (inner_cond);
t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), bits1, bits2);