Issue 210218.2: Generalize complex number support

Author: Tom Tromey
Champion: Zoran Zaric
Date submitted: 2021-02-18
Date revised: 2022-07-18
Date closed: 2023-01-23
Type: Enhancement
Status: Accepted
DWARF Version: 6

GCC can handle complex integers as well as complex floating-point types.
A complex type can be defined using type qualifier '_Complex' with any
floating point or integral type:

    _Complex int x;

This extension is GNU specific and not part of ISO C99.

However, DWARF has no way to represent these types, as there is only
DW_ATE_complex_float and DW_ATE_imaginary_float (Section page 106).

Another example of a language that uses integer based complex types is Rust
through the type trait mechanism.

In both cases, the complex type data can be represented with either
floating-point, signed integral or unsigned integral numbers.


In section, "Encoding attribute values", p 105, table 5.1,
"Base type encoding values", add new encoding group at the end of the

    Name                     | Meaning
 Complex integral encodings
 DW_ATE_complex_signed       | complex binary integral number
 DW_ATE_imaginary_signed     | imaginary binary integral number
 DW_ATE_complex_unsigned     | complex unsigned binary integral number
 DW_ATE_imaginary_unsigned   | imaginary unsigned binary integral number

In section 5.1.1, "Base Type Encodings", p 108, line 11, add a new
section with text:

  " Complex Integral Encodings

   Complex types with binary integral encodings (DW_ATE_complex_signed,
   DW_ATE_imaginary_signed, DW_ATE_complex_unsigned and
   DW_ATE_imaginary_unsigned) are supported in some programming
   languages (GNU C and Rust) and are not discussed further."

In section 7.8, "Base Type Attribute Encodings", p 227, table 7.11,
"Base type encoding values", add new encoding values at the end of the

    Base type encoding name    |  Value
    DW_ATE_complex_signed      |  0x0e
    DW_ATE_imaginary_signed    |  0x0f
    DW_ATE_complex_unsigned    |  0x10
    DW_ATE_imaginary_unsigned  |  0x11

2022-03-03: Revised.
2022-07-18: Revised, defining additional base type encodings.
            Previous version:
2023-01-23: Accepted.