https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83805
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Well, you have 3 objects, str1, str2 and the string literal, if the compiler thinks all 3 are needed, it emits all of them. Without -fmerge-all-constants str1 can't be merged with str2 nor with any other object.