From 4e436fdabe216b5684b4efb6978843b2380fe32a Mon Sep 17 00:00:00 2001 From: Nils-Christian Kempke Date: Mon, 11 Apr 2022 14:06:55 +0200 Subject: gdb/fortran: fix complex type in Fortran builtin types Before this patch things like (gdb) ptype complex*8 complex*16 (gdb) ptype complex*4 complex*8 were possible in GDB, which seems confusing for a user. The reason is a mixup in the implementation of the Fortran COMPLEX type. In Fortran the "*X" after a type would normally (I don't think this is language required) specify the type's size in memory. For the COMPLEX type the kind parameters usually (at least for GNU, Intel, Flang) specify not the size of the whole type but the size of the individual two REALs used to form the COMPLEX. Thus, a COMPLEX*4 will usually consist of two REAL*4s. Internally this type was represented by a builtin_complex_s8 - but here I think the s8 actually meant the raw size of the type. This is confusing and I renamed the types (e.g. builting_complex_s8 became builtin_complex_s4 according to its most common useage) and their printed names to their language equivalent. Additionally, I added the default COMPLEX type "COMPLEX" being the same as a COMPLEX*4 (as is normally the case) and removed the latter. I added a few tests for this new behavior as well. The new behavior is (gdb) ptype complex*8 complex*8 (gdb) ptype complex*4 complex*4 --- gdb/f-lang.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/f-lang.h') diff --git a/gdb/f-lang.h b/gdb/f-lang.h index 512325f..4e415f2 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -329,9 +329,9 @@ struct builtin_f_type struct type *builtin_real; struct type *builtin_real_s8; struct type *builtin_real_s16; + struct type *builtin_complex; struct type *builtin_complex_s8; struct type *builtin_complex_s16; - struct type *builtin_complex_s32; struct type *builtin_void; }; -- cgit v1.1