[Bug c/60256] No -Wuninitialized warning for strcpy

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 16 18:05:00 GMT 2014


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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We call c_fully_fold on strcpy (s, s);, and because this CALL_EXPR is
tcc_vl_exp, we call fold () on it.  fold () then via fold_call_expr -> ... 
calls fold_builtin_strcpy and that hits
  /* If SRC and DEST are the same (and not volatile), return DEST.  */
  if (operand_equal_p (src, dest, 0))
    return fold_convert_loc (loc, TREE_TYPE (TREE_TYPE (fndecl)), dest);

But on second thought, delayed folding won't help, as uninit passes are run
quite late and at that point strcpy(s, s); will be already gone.



More information about the Gcc-bugs mailing list