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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The ICE started with r211956, before that it was assumed that any non-NULL
si->stmt is something to be optimized with stpcpy and friends, so has to be
guarded when creating it so that such optimization isn't attempted if stpcpy
isn't declared.

So, for the ICE I'd like to fix it with:
--- gcc/tree-ssa-strlen.c.jj    2014-11-19 18:47:59.000000000 +0100
+++ gcc/tree-ssa-strlen.c    2014-11-20 09:46:33.949017462 +0100
@@ -430,7 +430,6 @@ get_string_length (strinfo si)
       callee = gimple_call_fndecl (stmt);
       gcc_assert (callee && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL);
       lhs = gimple_call_lhs (stmt);
-      gcc_assert (builtin_decl_implicit_p (BUILT_IN_STPCPY));
       /* unshare_strinfo is intentionally not called here.  The (delayed)
      transformation of strcpy or strcat into stpcpy is done at the place
      of the former strcpy/strcat call and so can affect all the strinfos
@@ -479,6 +478,7 @@ get_string_length (strinfo si)
     case BUILT_IN_STRCPY_CHK:
     case BUILT_IN_STRCPY_CHKP:
     case BUILT_IN_STRCPY_CHK_CHKP:
+      gcc_assert (builtin_decl_implicit_p (BUILT_IN_STPCPY));
       if (gimple_call_num_args (stmt) == (with_bounds ? 4 : 2))
         fn = builtin_decl_implicit (BUILT_IN_STPCPY);
       else

now that BUILT_IN_MALLOC uses si->stmt non-NULL too and obviously isn't in any
way related to stpcpy.  I'll look at the missed optimizations.

Reply via email to