--- Comment #2 from Jakub Jelinek <jakub at gcc dot> ---
Created attachment 43415

Untested fix.

BTW, the code is still problematic, e.g. the:
      if (code == ARRAY_REF || code == MEM_REF)
        lhs = TREE_OPERAND (lhs, 0);
For MEM_REF, TREE_OPERAND (lhs, 0) is either ADDR_EXPR of some decl, or an
SSA_NAME, I can understand what you can do with the SSA_NAME (for the stpncpy
result comparison which will also be a SSA_NAME), but other than that it is
then apples vs. oranges e.g. in the get_addr_base_and_unit_offset calls.

Also, the comment says:
  /* Look for dst[i] = '\0'; after the stxncpy() call and if found
     avoid the truncation warning.  */
but you aren't testing for that, but rather that there is any kind of
assignment after the strncpy call (no check that the rhs of the next_stmt is

Reply via email to