[Dwarf-discuss] ISSUE: CPU vector types.

Pedro Alves pedro@palves.net
Thu Mar 30 22:23:17 GMT 2023

On 2023-03-30 9:26 p.m., Pedro Alves wrote:
> So teaching DWARF to specify the location of the return value is actually orthogonal
> here -- we need to be able to distinguish regular C array from vector arrays for
> other reasons too, specifically, the types are different at the language level.
> So vector-ness should indeed be a property of the type.

Replying to myself to add more to this point, as it goes beyond just pointer decay.

See here:


For example:

 "The types defined in this manner can be used with a subset of normal C operations. Currently, GCC allows using the following
  operators on these types: +, -, *, /, unary minus, ^, |, &, ~, %.

  The operations behave like C++ valarrays. Addition is defined as the addition of the corresponding elements of the operands.
  For example, in the code below, each of the 4 elements in a is added to the corresponding 4 elements in b and the
  resulting vector is stored in c."

Should be obvious that these operations don't behave the same as normal C arrays.

Turns out GDB supports all these operations on vectors since 2010 (git 7346b668d73f,
and gdb.base/gnu_vector.exp testcase, if you're curious), and I managed to forget about all that
until I read the GCC page above.  :-)

Pedro Alves

More information about the Dwarf-discuss mailing list