[Bug tree-optimization/86526] [9 Regression] ICE in builtin_memcpy_read_str, at builtins.c:3017

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 16 10:10:00 GMT 2018


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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
As the patch contains a lot of formatting fixes (Qing, please watch out
formatting of your patches more carefully, there should be no whitespace at the
end of lines, tabs should be used rather than 8 spaces, we write type
*var_or_arg
rather than type* var_or_arg, etc.), here is just the important part from diff
-upb:

@@ -6785,6 +6785,8 @@ inline_string_cmp (rtx target, tree var_
   rtx result = target ? target : gen_reg_rtx (mode); 
   rtx_code_label *ne_label = gen_label_rtx ();  
   tree unit_type_node = is_memcmp ? unsigned_char_type_node : char_type_node;
+  scalar_int_mode unit_mode
+    = as_a <scalar_int_mode> TYPE_MODE (unit_type_node);

   start_sequence ();

@@ -6792,11 +6794,7 @@ inline_string_cmp (rtx target, tree var_
     {
       var_rtx 
        = adjust_address (var_rtx_array, TYPE_MODE (unit_type_node), offset);
-      const_rtx 
-       = builtin_memcpy_read_str (CONST_CAST (char *, const_str),
-                                  offset,
-                                  as_a <scalar_int_mode> 
-                                  TYPE_MODE (unit_type_node));
+      const_rtx = c_readstr (const_str + offset, unit_mode);
       rtx op0 = (const_str_n == 1) ? const_rtx : var_rtx;
       rtx op1 = (const_str_n == 1) ? var_rtx : const_rtx;

@@ -6805,8 +6803,7 @@ inline_string_cmp (rtx target, tree var_
       if (i < length - 1) 
         emit_cmp_and_jump_insns (result, CONST0_RTX (mode), NE, NULL_RTX,
                                 mode, true, ne_label);
-      offset 
-       += GET_MODE_SIZE (as_a <scalar_int_mode> TYPE_MODE (unit_type_node));
+      offset += GET_MODE_SIZE (unit_mode);
     }

   emit_label (ne_label);


More information about the Gcc-bugs mailing list