OSDN Git Service

2010-12-06 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Dec 2010 12:53:38 +0000 (12:53 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Dec 2010 12:53:38 +0000 (12:53 +0000)
PR tree-optimization/46806
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Do not
coalesce different types.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167490 138bc75d-0d04-0410-961f-82ee72b054a4

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

index ccb7019..f01b9fe 100644 (file)
@@ -1,5 +1,11 @@
 2010-12-06  Richard Guenther  <rguenther@suse.de>
 
 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-06  Richard Guenther  <rguenther@suse.de>
+
        PR tree-optimization/46785
        * tree-vect-loop.c (vect_is_simple_reduction_1): Also allow
        call statements as operand definition.
        PR tree-optimization/46785
        * tree-vect-loop.c (vect_is_simple_reduction_1): Also allow
        call statements as operand definition.
index 600655d..5c3b697 100644 (file)
@@ -1,5 +1,10 @@
 2010-12-06  Richard Guenther  <rguenther@suse.de>
 
 2010-12-06  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/46806
+       * g++.dg/torture/20100825.C: New testcase.
+
+2010-12-06  Richard Guenther  <rguenther@suse.de>
+
        PR tree-optimization/46785
        * gcc.dg/vect/fast-math-vect-reduc-9.c: New testcase.
 
        PR tree-optimization/46785
        * gcc.dg/vect/fast-math-vect-reduc-9.c: New testcase.
 
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 41d43a6..abee6b9 100644 (file)
@@ -226,11 +226,11 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
       ign2 = false;
     }
 
       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)
     {
       if (debug)
-       fprintf (debug, " : Incompatible types.  No coalesce.\n");
+       fprintf (debug, " : Different types.  No coalesce.\n");
       return false;
     }
 
       return false;
     }