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

            Bug ID: 114186
           Summary: Incorrect CTF generated for multidimensional array
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ibhagat at gcc dot gnu.org
  Target Milestone: ---

$ cat array.c 
int a[5][9][3];
$ gcc -O0 -gctf -dA -S array.c

Excerpt from array.s:

...        
        .long   0x17    # ctv_name
        .long   0x5     # ctv_typeidx

=> a variable of type id = 5

        .long   0x1     # ctt_name
        .long   0x6000000       # ctt_info
        .long   0x4     # ctt_size or ctt_type
        .long   0x1000020       # ctf_encoding_data

=> type id = 1, type = int

        .long   0x5     # ctt_name
        .long   0x6000000       # ctt_info
        .long   0x8     # ctt_size or ctt_type
        .long   0x40    # ctf_encoding_data

=> type id = 2, type = long unsigned int

        .long   0       # ctt_name
        .long   0x12000000      # ctt_info
        .long   0       # ctt_size or ctt_type
        .long   0x1     # cta_contents
        .long   0x2     # cta_index
        .long   0x5     # cta_nelems

=> type id = 3, nelems = 5, array contents (cta_contents) of type with type id
= 1

        .long   0       # ctt_name
        .long   0x12000000      # ctt_info
        .long   0       # ctt_size or ctt_type
        .long   0x3     # cta_contents
        .long   0x2     # cta_index
        .long   0x9     # cta_nelems

=> type id = 4, nelems = 9, array contents (cta_contents) of type with type id
= 3 

        .long   0       # ctt_name
        .long   0x12000000      # ctt_info
        .long   0       # ctt_size or ctt_type
        .long   0x4     # cta_contents
        .long   0x2     # cta_index
        .long   0x3     # cta_nelems

=> type id = 5, nelems = 3, array contents (cta_contents) of type with type id
= 4

In other words, the data type of the variable is being emitted as if it were
int a[3][9][5]

Reply via email to