https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121394
--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:405f45aae779fe7694e8660cfa828f1cef58b101 commit r16-3116-g405f45aae779fe7694e8660cfa828f1cef58b101 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Thu Aug 7 11:44:21 2025 -0700 varasm: Ensure each variable in mergeable section is the entity size [PR121394] Now there are mergeable sections which have an entity size, we can place decls (constants) that are smaller in size in these sections. An example is an `long double` which has a size of 12 bytes on i686 and is placed in the 16 bytes shareable section. For an example with the following C++ code: ``` std::initializer_list<long double> a = {0.3l}; ``` We place the constant array in the .rodata.cst16 section but we don't add a padding to 16 bytes. ``` .section .rodata.cst16,"aM",@progbits,16 .align 16 .type _ZGR1a_, @object .size _ZGR1a_, 12 _ZGR1a_: .long -1717986918 .long -1717986919 .long 16381 .text ``` GAS has a workaround added to do the padding but other assemblers don't. The gas workaround was added with https://sourceware.org/legacy-ml/binutils/2002-11/msg00615.html . Now for the constant pool, GCC does emit a `.align` to padd out the size correctly. This was done in r0-46282-gf41115930523b3. The same padding should be done when emitting a variable contents when in a mergeable section. This patch implements the padding and we now get an addition `.zero 4` which pads out the section. Bootstrapped and tested on x86_64-linux-gnu. PR middle-end/121394 gcc/ChangeLog: * varasm.cc (assemble_variable_contents): Pad out mergeable sections if needed. (output_constant_pool_1): Change the padding to be explicit zeroing for mergeable sections. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>