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

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
The strcpy() calls are first transformed into

  MEM[(char * {ref-all})&a] = MEM[(char * {ref-all})"12"];

In GCC 7, the above is then transformed into

  MEM[(char * {ref-all})&a] = "12";

(I'm not sure what the difference is).  In GCC 7, the second instance of the
above is then removed in fre1.

In GCC 8, the second instance makes it all the way to the strlen pass where
handle_char_store() isn't prepared to deal with it if a length record exists
for the destination.  I think the strlen() limitation can be handled by the
same solution as bug 86043: i.e., have handle_char_store() handle cases where
substrings of any length is overwritten without changing their length, not just
those of length one by plain character assignment.

I don't know why the duplicate MEM assignment above isn't eliminated earlier
(that may be a separate bug).

Reply via email to