diff --git a/gdb/f-exp.y b/gdb/f-exp.y index d6103a06e44..a768134983b 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -171,7 +171,7 @@ static int parse_number (struct parser_state *, const char *, int, %token LOGICAL_S8_KEYWORD %token LOGICAL_KEYWORD REAL_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD %token COMPLEX_KEYWORD -%token COMPLEX_S8_KEYWORD COMPLEX_S16_KEYWORD COMPLEX_S32_KEYWORD +%token COMPLEX_S4_KEYWORD COMPLEX_S8_KEYWORD COMPLEX_S16_KEYWORD %token BOOL_AND BOOL_OR BOOL_NOT %token SINGLE DOUBLE PRECISION %token CHARACTER @@ -778,21 +778,21 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */ | REAL_S16_KEYWORD { $$ = parse_f_type (pstate)->builtin_real_s16; } | COMPLEX_KEYWORD - { $$ = parse_f_type (pstate)->builtin_complex_s8; } + { $$ = parse_f_type (pstate)->builtin_complex; } + | COMPLEX_S4_KEYWORD + { $$ = parse_f_type (pstate)->builtin_complex; } | COMPLEX_S8_KEYWORD { $$ = parse_f_type (pstate)->builtin_complex_s8; } | COMPLEX_S16_KEYWORD { $$ = parse_f_type (pstate)->builtin_complex_s16; } - | COMPLEX_S32_KEYWORD - { $$ = parse_f_type (pstate)->builtin_complex_s32; } | SINGLE PRECISION { $$ = parse_f_type (pstate)->builtin_real;} | DOUBLE PRECISION { $$ = parse_f_type (pstate)->builtin_real_s8;} | SINGLE COMPLEX_KEYWORD - { $$ = parse_f_type (pstate)->builtin_complex_s8;} + { $$ = parse_f_type (pstate)->builtin_complex;} | DOUBLE COMPLEX_KEYWORD - { $$ = parse_f_type (pstate)->builtin_complex_s16;} + { $$ = parse_f_type (pstate)->builtin_complex_s8;} ; nonempty_typelist @@ -1020,14 +1020,14 @@ convert_to_kind_type (struct type *basetype, int kind) if (kind == 1) return parse_f_type (pstate)->builtin_character; } - else if (basetype == parse_f_type (pstate)->builtin_complex_s8) + else if (basetype == parse_f_type (pstate)->builtin_complex) { if (kind == 4) - return parse_f_type (pstate)->builtin_complex_s8; + return parse_f_type (pstate)->builtin_complex; else if (kind == 8) - return parse_f_type (pstate)->builtin_complex_s16; + return parse_f_type (pstate)->builtin_complex_s8; else if (kind == 16) - return parse_f_type (pstate)->builtin_complex_s32; + return parse_f_type (pstate)->builtin_complex_s16; } else if (basetype == parse_f_type (pstate)->builtin_real) { @@ -1130,18 +1130,18 @@ static const struct f77_boolean_val boolean_values[] = static const struct token f77_keywords[] = { /* Historically these have always been lowercase only in GDB. */ + { "complex", COMPLEX_KEYWORD, OP_NULL, true }, + { "complex_4", COMPLEX_S4_KEYWORD, OP_NULL, true }, + { "complex_8", COMPLEX_S8_KEYWORD, OP_NULL, true }, { "complex_16", COMPLEX_S16_KEYWORD, OP_NULL, true }, - { "complex_32", COMPLEX_S32_KEYWORD, OP_NULL, true }, { "character", CHARACTER, OP_NULL, true }, { "integer_2", INT_S2_KEYWORD, OP_NULL, true }, { "logical_1", LOGICAL_S1_KEYWORD, OP_NULL, true }, { "logical_2", LOGICAL_S2_KEYWORD, OP_NULL, true }, { "logical_8", LOGICAL_S8_KEYWORD, OP_NULL, true }, - { "complex_8", COMPLEX_S8_KEYWORD, OP_NULL, true }, { "integer", INT_KEYWORD, OP_NULL, true }, { "logical", LOGICAL_KEYWORD, OP_NULL, true }, { "real_16", REAL_S16_KEYWORD, OP_NULL, true }, - { "complex", COMPLEX_KEYWORD, OP_NULL, true }, { "sizeof", SIZEOF, OP_NULL, true }, { "real_8", REAL_S8_KEYWORD, OP_NULL, true }, { "real", REAL_KEYWORD, OP_NULL, true }, diff --git a/gdb/f-lang.c b/gdb/f-lang.c index e329f0646e2..3c3ca0c0d71 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1565,8 +1565,8 @@ f_language::language_arch_info (struct gdbarch *gdbarch, add (builtin->builtin_real); add (builtin->builtin_real_s8); add (builtin->builtin_real_s16); + add (builtin->builtin_complex); add (builtin->builtin_complex_s8); - add (builtin->builtin_complex_s16); add (builtin->builtin_void); lai->set_string_char_type (builtin->builtin_character); @@ -1665,17 +1665,17 @@ build_fortran_types (struct gdbarch *gdbarch) builtin_f_type->builtin_real_s16 = arch_type (gdbarch, TYPE_CODE_ERROR, 128, "real*16"); + builtin_f_type->builtin_complex + = init_complex_type ("complex*4", builtin_f_type->builtin_real); builtin_f_type->builtin_complex_s8 - = init_complex_type ("complex*8", builtin_f_type->builtin_real); - builtin_f_type->builtin_complex_s16 - = init_complex_type ("complex*16", builtin_f_type->builtin_real_s8); + = init_complex_type ("complex*8", builtin_f_type->builtin_real_s8); if (builtin_f_type->builtin_real_s16->code () == TYPE_CODE_ERROR) - builtin_f_type->builtin_complex_s32 - = arch_type (gdbarch, TYPE_CODE_ERROR, 256, "complex*32"); + builtin_f_type->builtin_complex_s16 + = arch_type (gdbarch, TYPE_CODE_ERROR, 256, "complex*16"); else - builtin_f_type->builtin_complex_s32 - = init_complex_type ("complex*32", builtin_f_type->builtin_real_s16); + builtin_f_type->builtin_complex_s16 + = init_complex_type ("complex*16", builtin_f_type->builtin_real_s16); return builtin_f_type; } diff --git a/gdb/f-lang.h b/gdb/f-lang.h index 512325f1a11..4e415f21f43 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; }; diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp index 625e02196ad..4205d308be7 100644 --- a/gdb/testsuite/gdb.fortran/types.exp +++ b/gdb/testsuite/gdb.fortran/types.exp @@ -76,7 +76,7 @@ proc test_float_literal_types_accepted {} { proc test_primitive_types_known {} { foreach type {void character logical*1 integer*1 integer*2 integer*8 \ logical*2 logical*8 integer logical*4 real \ - real*8 real*16} { + real*8 real*16 complex*4 complex*8 complex*16} { gdb_test "ptype $type" [string_to_regexp "type = $type"] } }