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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
To me the testcase looks invalid:

   integer, parameter :: n = 5
   character(len=1), parameter :: s(n) = 'a'
   type :: a
      integer :: m = n
      character(len=1):: t(n) = transfer('abcde             ', s)

this initializes an array of size 5 with a sequence of too many chars:

bar ()
{
  static struct a c = {.m=5, .t={"a", "b", "c", "d", "e", " ", " ", " ", " ", "
", " ", " ", " ", " ", " ", " ", " ", " "}};

OTOH maybe nothing cares.  But we definitely do output the constants and for
aarch64 I see:

        .set    .LANCHOR0,. + 0
        .type   options.3.2654, %object
        .size   options.3.2654, 28
options.3.2654:
        .word   102
        .word   8191
        .word   1
        .word   1
        .word   1
        .word   0
        .word   31
        .zero   4
        .type   c.2640, %object
        .size   c.2640, 12
c.2640:
        .word   5
        .ascii  "a"
        .ascii  "b"
        .ascii  "c"
        .ascii  "d"
        .ascii  "e"
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .ascii  " "
        .zero   4
        .type   A.1.2647, %object
        .size   A.1.2647, 40
A.1.2647:
        .xword  .LC0
        .xword  .LC1
        .xword  .LC2
...

notice the bogus .size of c.2640.  But then we get to both c and A via

        adrp    x0, .LANCHOR0
        add     x0, x0, :lo12:.LANCHOR0
        add     x3, x0, 32
        add     x0, x0, 48

which looks wrong.

Not sure why it worked before (or why it doesn't work on powerpc) but
clearly the frontend emits bogus IL here and/or the output machinery
should avoid emitting excess elements(?).

Reply via email to