RE: [PATCH v2 1/7] Change how complex types are created

Aktemur, Tankut Baris
2020-04-02T14:59:55Z

On Friday, March 20, 2020 10:54 PM, Tom Tromey wrote:
> This patch changes how complex types are created. init_complex_type
> and arch_complex_type are unified, and complex types are reused, by
> attaching them to the underlying scalar type.
>
> gdb/ChangeLog
> 2020-03-20 Tom Tromey <tom@tromey.com>
>
> * stabsread.c (rs6000_builtin_type, read_sun_floating_type)
> (read_range_type): Update.
> * mdebugread.c (basic_type): Update.
> * go-lang.c (build_go_types): Use init_complex_type.
> * gdbtypes.h (struct main_type) <complex_type>: New member.
> (init_complex_type): Update.
> (arch_complex_type): Don't declare.
> * gdbtypes.c (init_complex_type): Remove "objfile" parameter.
> Make name if none given. Use alloc_type_copy. Look for cached
> complex type.
> (arch_complex_type): Remove.
> (gdbtypes_post_init): Use init_complex_type.
> * f-lang.c (build_fortran_types): Use init_complex_type.
> * dwarf2/read.c (read_base_type): Update.
> * d-lang.c (build_d_types): Use init_complex_type.
> * ctfread.c (read_base_type): Update.

Hi Tom,

The all-architectures tests (e.g. gdb.base/all-architectures-2.exp) started failing
after the commit (5b930b4538f "Change how complex types are created") because of an
assertion.

A manual way to reproduce the cause is

$ gdb -q
(gdb) set architecture c5
The target architecture is assumed to be c5
(gdb) ptype 1.0L
type = /gdb/gdbtypes.c:3037: internal-error: type* init_complex_type(const char*, type*): Assertion `TYPE_CODE (target_type) == TYPE_CODE_INT || TYPE_CODE (target_type) == TYPE_CODE_FLT' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

This GDB was configured with --enable-targets=all.

Thanks.
-Baris

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928