https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96427

            Bug ID: 96427
           Summary: Missing align attribute for anchor section from local
                    variables
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhongyunde at tom dot com
  Target Milestone: ---

For the following code, we can known the local array a_1 is aligned 64 bytes,
but now gcc only aligned to default 32 bytes for related anchor data.

====================== test case ================================
int bar (long long v);
int foo (int i)
{
  long long v;
  int a_1[131] __attribute__((aligned(64))) = {38580, 691093, 378582, 691095,
938904, 251417, 38906, 251419, 2938908, 251421, 938910, 4863, 92352, 104865,
792354, 4867, 2792356,251429, 938918,251431, 938920,251433, 938922, 104875,
22792364, 104877, 2792366, 104879, 2792368, 104881, 6180210,8492723,
6180212,8492725,
6180214,8492727,33656,346169,33658,346171,33660,346173,33662,8492735,
6180224,8492737, 6180226,8492739,
6180228,346181,33670,346183,33672,346185,33674,7906507, 593996,7906509,
593998,7906511, 594000,7906513,447442,7759955,447444,7759957,447446,7759959,
594008,7906521, 594010,7906523, 594012,7906525,
594014,7759967,447456,7759969,447458,7759971,447460,8492773, 6180262,8492775,
6180264,8492777, 6180266,346219,33708,346221,33710,346223,33712,346225,
6180274,8492787, 6180276,8492789,
6180278,8492791,33720,346233,33722,346235,33724,346237,33726,7906559,
594048,7906561, 594050,7906563,
594052,7760005,447494,7760007,447496,7760009,447498,7906571, 594060,7906573,
594062,7906575, 94064, 7906577, 447506, 760019, 447508, 760021, 447510};
  const long long * ptr = (const long long *)a_1;
  v = ptr[0];

  return bar (v);
} 

========= test base on the X86 gcc 9.3 on https://gcc.godbolt.org  ========= 
        .text
.Ltext0:
        .section   .rodata
        .align 32  # here, use the default alignment 32 byte of section .rodata
.LC0:
        .long   38580
        .long   691093
        .long   378582
        ...

foo(int):
        mov     rdi, QWORD PTR .LC0[rip]
        jmp     bar(long long)

Reply via email to