AsmPrinter.cpp: emitting trailing padding for global data array in emitGlobalConstantDataSequential

Hello all,

Looking at the emitGlobalConstantDataSequential function in lib/CodeGen/AsmPrinter/AsmPrinter.cpp there is a code there responsible for emitting of the potential trailing padding for the global array.

Is there an example ( preferably C code ) that triggers this code? AFAIU no trailing padding should be generated for global data arrays.



You're right, no trailing padding will be generated for arrays: the alignment of an array is the same as the alignment of its element type. We can end up with trailing padding for vectors, though. For example:

typedef float float3 __attribute((ext_vector_type(3)));
float3 x = {1,2,3};