http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46806
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2010.12.05 22:13:20 AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-05 22:13:20 UTC --- Heh, you are seeing a dup of https://bugzilla.novell.com/show_bug.cgi?id=623386 (sorry, not public). Which is a copyrename issue and hard to trigger (I couldn't trigger it with anything other than 4.3). 4.3 testcase: 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 (); } And I have a patch (maybe I even posted it just didn't apply it), the problem is we are coalescing a variable of enum type with one of integer type. Index: gcc/tree-ssa-copyrename.c =================================================================== *** gcc/tree-ssa-copyrename.c (revision 163549) --- gcc/tree-ssa-copyrename.c (working copy) *************** copy_rename_partition_coalesce (var_map *** 239,245 **** } /* Don't coalesce if the two variables aren't type compatible. */ ! if (!types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2))) { if (debug) fprintf (debug, " : Incompatible types. No coalesce.\n"); --- 239,246 ---- } /* Don't coalesce if the two variables aren't type compatible. */ ! if (TYPE_MAIN_VARIANT (TREE_TYPE (root1)) ! != TYPE_MAIN_VARIANT (TREE_TYPE (root2))) { if (debug) fprintf (debug, " : Incompatible types. No coalesce.\n"); Seems I did post an earlier version for comments: http://gcc.gnu.org/ml/gcc-patches/2010-08/msg01873.html