]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/46806 (-O3 implies 0 <= 8 <= 7)
authorRichard Guenther <rguenther@suse.de>
Mon, 6 Dec 2010 13:07:12 +0000 (13:07 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 6 Dec 2010 13:07:12 +0000 (13:07 +0000)
2010-12-06  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/46806
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Do not
coalesce different types.

* g++.dg/torture/20100825.C: New testcase.

From-SVN: r167492

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/20100825.C [new file with mode: 0644]
gcc/tree-ssa-copyrename.c

index a786b2397073eb28b1d42caa1eff53e91afcb04f..bd39775fbb003240a68e856ae1407e37598fa398 100644 (file)
@@ -1,3 +1,9 @@
+2010-12-06  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/46806
+       * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Do not
+       coalesce different types.
+
 2010-12-05  Richard Guenther  <rguenther@suse.de>
            Ira Rosen  <irar@il.ibm.com>
 
index 3e35222e6973fc749ea0050a5da68b2a5bb0dff5..4bacae2f084934910610c9c78df045a64b5cc4b7 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-06  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/46806
+       * g++.dg/torture/20100825.C: New testcase.
+
 2010-12-05  Richard Guenther  <rguenther@suse.de>
            Ira Rosen  <irar@il.ibm.com>
 
diff --git a/gcc/testsuite/g++.dg/torture/20100825.C b/gcc/testsuite/g++.dg/torture/20100825.C
new file mode 100644 (file)
index 0000000..460c1b6
--- /dev/null
@@ -0,0 +1,15 @@
+// { dg-do run }
+
+typedef enum { zero = 0, one = 1, two = 2, ENUM_MAX = 3 } my_enum;
+my_enum e;
+extern "C" void abort (void);
+int __attribute__((noinline)) foo() { return 10; }
+int main()
+{
+  int r;
+  r = foo();
+  if ((r < 0) || (r >= ENUM_MAX))
+    return 0;
+  e = (my_enum)r;
+  abort ();
+}
index d62a09416d14da5a44f3393c1112baaa8e74ac72..8baef94a204e650ec2cd58017ef8bdcd41f03eae 100644 (file)
@@ -225,11 +225,11 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
       ign2 = false;
     }
 
-  /* Don't coalesce if the two variables aren't type compatible.  */
-  if (!types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2)))
+  /* Don't coalesce if the two variables are not of the same type.  */
+  if (TREE_TYPE (root1) != TREE_TYPE (root2))
     {
       if (debug)
-       fprintf (debug, " : Incompatible types.  No coalesce.\n");
+       fprintf (debug, " : Different types.  No coalesce.\n");
       return false;
     }