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/67915] ICE on valid code at -O2 and -O3 on x86_64-linux-gnu


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67915

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Index: gcc/tree-cfgcleanup.c
===================================================================
--- gcc/tree-cfgcleanup.c       (revision 228753)
+++ gcc/tree-cfgcleanup.c       (working copy)
@@ -103,17 +103,22 @@ cleanup_control_expr_graph (basic_block
       edge e;
       edge_iterator ei;
       bool warned;
-      location_t loc;

       fold_defer_overflow_warnings ();
-      loc = gimple_location (stmt);
       switch (gimple_code (stmt))
        {
        case GIMPLE_COND:
-         val = fold_binary_loc (loc, gimple_cond_code (stmt),
-                                boolean_type_node,
-                                gimple_cond_lhs (stmt),
-                                gimple_cond_rhs (stmt));
+         val = const_binop (gimple_cond_code (stmt),
+                            boolean_type_node,
+                            gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
+         if (!val)
+           {
+             tree tem = fold_binary (gimple_cond_code (stmt),
+                                     boolean_type_node,
+                                     gimple_cond_lhs (stmt),
+                                     gimple_cond_rhs (stmt));
+             gcc_assert (!tem || TREE_CODE (tem) != INTEGER_CST);
+           }
          break;

        case GIMPLE_SWITCH:

fails in configuring stage2 gcc/ on

if (_12 < 0)

but probably because of your earlier patch now ... and with that disabled on

if (base.96 != base.96)

which is during CFG build in stage2 libcpp lex.c.  It's the GIMPLIFIERs
"CSE" producing

  <bb 101>:
  base.96 = base;
  base.96 = base;
  if (base.96 != base.96)

(see gimplify.c:lookup_tmp_var) and us not folding that stmt during
gimplification (the thing to fix).  Let's see how far I get with that ;)


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