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

--- Comment #6 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2012-09-04 
23:06:29 UTC ---
Oh I see, my bad to have missed your command line. Sorry.  

I see what's going on here. It's just luck that this works on x86_64 with your
invocation. 


>$ objdump -h non-collected-strings.o  | grep str
>non-collected-strings.o:     file format elf64-x86-64
>  3 .rodata.str1.8 0000001f  0000000000000000  0000000000000000  00000040  2**3
>  5 .rodata.str1.1 0000001b  0000000000000000  0000000000000000  0000006f  2**0

Try with -Os on x86_64 and it should fail there as well on trunk / earlier
versions of GCC. 

Notice one string has an alignment of 8 and the other 1 and that's what drew my
attention to the funniness in this testcase.

The reason for this is the play with CONSTANT_ALIGNMENT in the backends. If the
strings gets the same alignment you end up with the strings in the same
sections which means the whole thing doesn't work and if they have a different
alignment as with your invocation, it all works fine. :(


regards,
ramana

Reply via email to