]> sourceware.org Git - libabigail.git/commit
ctf-reader: Fix representation of multidimensional arrays
authorGuillermo E. Martinez <guillermo.e.martinez@oracle.com>
Thu, 17 Nov 2022 03:43:04 +0000 (21:43 -0600)
committerDodji Seketeli <dodji@redhat.com>
Wed, 30 Nov 2022 09:39:51 +0000 (10:39 +0100)
commite33a74fb8c096bc190704402983acfeca25fc3ee
treee332bd0d2ea5089ab201fc878d2d10f93f6b7fdc
parent916f541a9a2e2f3c2f695faffccdadf1481d3209
ctf-reader: Fix representation of multidimensional arrays

To build an IR for multidimensional array the CTF front-end iterates
over the element types recursively.

So, consider the array definition:

  char a[2][3][4][5];

It's represented as

  'char[2][3][4] a[5]'

instead of:

  'char a[2][3][4][5]'

It always considers multidimensional arrays as unidimensional creating
a `array-type-def' node for each dimension:

  <array-type-def dimensions='1' type-id='type-id-1' ... >
    <subrange length='2' type-id='type-id-3' id='type-id-4'/>
  </array-type-def>
  <array-type-def dimensions='1' type-id='type-id-2' ... >
    <subrange length='3' type-id='type-id-3' id='type-id-6'/>
  </array-type-def>
  ...

Instead of:

  <array-type-def dimensions='4' type-id='type-id-1' ... >
     <subrange length='2' type-id='type-id-3' id='type-id-4'/>
     <subrange length='3' type-id='type-id-3' id='type-id-5'/>
     ...
  </array-type-def>

Fixed thus.

* src/abg-ctf-reader.cc (+build_array_ctf_range): New definition.
* tests/data/Makefile.am: Add new testcase.
* tests/data/test-read-ctf/test-array-mdimension.abi: New testcase.
* tests/data/test-read-ctf/test-array-mdimension.c: Likewise.
* tests/data/test-read-ctf/test-array-mdimension.o: Likewise.
* tests/data/test-read-ctf/test9.o.abi: Adjust.
* tests/test-read-ctf.cc: Update testsuite.

Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-ctf-reader.cc
tests/data/Makefile.am
tests/data/test-read-ctf/test-array-mdimension.abi [new file with mode: 0644]
tests/data/test-read-ctf/test-array-mdimension.c [new file with mode: 0644]
tests/data/test-read-ctf/test-array-mdimension.o [new file with mode: 0644]
tests/data/test-read-ctf/test9.o.abi
tests/test-read-ctf.cc
This page took 0.029099 seconds and 5 git commands to generate.