This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/49911] SRA + DOM + VRP + -fstrict-enums incorrectly remove predicate


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49911

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-01 09:05:38 UTC ---
verifier patch that would catch at least computation results (but not loads):

Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c      (revision 176998)
+++ gcc/tree-cfg.c      (working copy)
@@ -3241,6 +3314,16 @@ verify_gimple_assign_unary (gimple stmt)
       return true;
     }

+  if (INTEGRAL_TYPE_P (lhs_type)
+      && (!tree_int_cst_equal (TYPE_MIN_VALUE (lhs_type),
+                              lower_bound_in_type (lhs_type, lhs_type))
+         || !tree_int_cst_equal (TYPE_MAX_VALUE (lhs_type),
+                                 upper_bound_in_type (lhs_type, lhs_type))))
+    {
+      error ("register with non-canonical bounds");
+      return true;
+    }
+
   /* First handle conversions.  */
   switch (rhs_code)
     {
@@ -3397,6 +3480,16 @@ verify_gimple_assign_binary (gimple stmt
       return true;
     }

+  if (INTEGRAL_TYPE_P (lhs_type)
+      && (!tree_int_cst_equal (TYPE_MIN_VALUE (lhs_type),
+                              lower_bound_in_type (lhs_type, lhs_type))
+         || !tree_int_cst_equal (TYPE_MAX_VALUE (lhs_type),
+                                 upper_bound_in_type (lhs_type, lhs_type))))
+    {
+      error ("register with non-canonical bounds");
+      return true;
+    }
+
   /* First handle operations that involve different types.  */
   switch (rhs_code)
     {


shows that the IL after SRA is broken:

t.ii: In function 'void jsop_setelem(bool, int)':
t.ii:32:6: error: register with non-canonical bounds
D.1816_11 = (RegisterID) z_3(D);

t.ii:32:6: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]