https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70605
--- Comment #1 from kargl at gcc dot gnu.org --- You failed to identify what you expected. I suspect what you call correct output is troutmask:sgk[205] ./z string_in, string_cat_with_comma result: hello, hello added hello to get hello str_len1, strlen2, tot_len: 7 5 13 string_in, string_cat_with_comma result: goodbye, hello,goodbye added goodbye to get hello,goodbye str_len1, strlen2, tot_len: 8 13 22 string_in, string_cat_with_comma result: waithere, hello,goodbye,waithere added waithere to get hello,goodbye,waithere ********** string_in, string_cat_with_comma result: hello, hello added hello to get hello str_len1, strlen2, tot_len: 7 5 13 string_in, string_cat_with_comma result: goodbye, hello,goodbye added goodbye to get hello,goodbye str_len1, strlen2, tot_len: 8 13 22 string_in, string_cat_with_comma result: waithere, hello,goodbye,waithere added waithere to get hello,goodbye,waithere The issue appears to be fixed on trunk and in the 5-branch.