[Dwarf-discuss] ISSUE: vector types. V2

Metzger, Markus T markus.t.metzger@intel.com
Thu Apr 6 10:47:02 GMT 2023

Hello Jakub, Ben,

>On Wed, Apr 05, 2023 at 07:16:35PM -0700, Ben Woodard via Dwarf-discuss wrote:
>> To distinguish these vector types from regular C arrays, GCC's DWARF
>> describes a vector type as an array with the DW_AT_GNU_vector
>> attribute.  Clang also supports the GCC vector extensions, and
>> describes the vector types in DWARF using the same attribute as GCC.
>> Support for this DWARF extension has been implemented in GDB for well
>> over a decade.
>> Other languages have support for vector types, with similar ABI and/or
>> API implications, and so DW_AT_GNU_vector is also used for languages
>> beyond C/C++ today.
>> This proposal standardizes the existing behavior.
>I don't think this is a good idea, we should go for
>instead IMHO.  DW_AT_GNU_vector used to be a good idea as an extension,
>as mentioned the (generic) vector types are in many ways similar to arrays,
>so even a DWARF consumer which doesn't understand DW_AT_GNU_vector could
>handle the vector types sanely in some cases.
>But as you also mention, vector types are in various ways different from
>array types.  Not sure if supporting dimensions in the way which is done
>for arrays is needed (I believe vector types are always one-dimensional
>indexed from 0).  And we almost certainly want to allow vectors on DWARF
>expression stack; I'd probably not make DW_TAG_vector_type a base type,
>but extended the typed DWARF stack so that it can contain base types or
>DW_TAG_vector_type of base types or something similar.

Is there a limit to the length of such a vector type?  Would the language
define fixed-length vectors as special built-in types or is the goal to support
arbitrary vector lengths?

It might be good to maintain an upper limit on the size of a stack entry.

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

More information about the Dwarf-discuss mailing list