From patchwork Tue Feb 12 16:10:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 31417 Received: (qmail 68208 invoked by alias); 12 Feb 2019 16:11:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 68095 invoked by uid 89); 12 Feb 2019 16:11:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr1-f42.google.com Received: from mail-wr1-f42.google.com (HELO mail-wr1-f42.google.com) (209.85.221.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Feb 2019 16:11:21 +0000 Received: by mail-wr1-f42.google.com with SMTP id t27so3296320wra.6 for ; Tue, 12 Feb 2019 08:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=5cAh/4R2K10IV/OG422Cr3DWfCiDwFNcmCsfv0qANnk=; b=LLw+OLlgb3i05AVt3ktYz//DKm0evDLl1tUnMhP7KxECrIEDw5N6L/u6wNRiM3EZWw 66MbqT7NKTJks+8e0p6+7GhZdHaQDmPxlek8Eyor+xo9uq5+3d4V9rn26w3+teszTilg +v5+ZlLRiphZYJ53/zWa7Ywie0ZslvZxoIIoHRLzhlPXfgc0Z8eBGlMSmfz4l5w/8dES LblWNMGfUYxii9GTo2adgjK6cwzTcqhxPxnyOlFMtcauwqfFEpwpZbVrjZrE0/E2xl51 vEL+DaLm8yVzboTDXo7aRTXdViCWJS/6hi15oO1HEwwDsFWTxcDqwYaHyieHdCynFuqx n7zQ== Return-Path: Received: from localhost (host81-151-161-9.range81-151.btcentralplus.com. [81.151.161.9]) by smtp.gmail.com with ESMTPSA id z17sm10110096wrs.75.2019.02.12.08.11.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 08:11:17 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Richard Bunt , Andrew Burgess Subject: [PATCH 08/11] gdb/fortran: Add builtin 8-byte integer type with (kind=8) support Date: Tue, 12 Feb 2019 16:10:59 +0000 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Add a new builtin type, an 8-byte integer, and allow GDB to parse 'integer (kind=8)', returning the new 8-byte integer. gdb/ChangeLog: * f-exp.y (convert_to_kind_type): Handle integer (kind=8). * f-lang.c (build_fortran_types): Setup builtin_integer_s8. * f-lang.h (struct builtin_f_type): Add builtin_integer_s8 field. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp: Test new integer type kind. --- gdb/ChangeLog | 6 ++++++ gdb/f-exp.y | 2 ++ gdb/f-lang.c | 4 ++++ gdb/f-lang.h | 1 + gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.fortran/type-kinds.exp | 1 + 6 files changed, 18 insertions(+) diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 980ee4b4adb..d256ff14c1e 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -865,6 +865,8 @@ convert_to_kind_type (struct type *basetype, int kind) return parse_f_type (pstate)->builtin_integer_s2; else if (kind == 4) return parse_f_type (pstate)->builtin_integer; + else if (kind == 8) + return parse_f_type (pstate)->builtin_integer_s8; } error (_("unsupported kind %d for type %s"), diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 72dafe6d66f..7bed3189283 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -374,6 +374,10 @@ build_fortran_types (struct gdbarch *gdbarch) = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0, "integer*2"); + builtin_f_type->builtin_integer_s8 + = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0, + "integer*8"); + builtin_f_type->builtin_logical_s2 = arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1, "logical*2"); diff --git a/gdb/f-lang.h b/gdb/f-lang.h index a4ae6a726d9..7164585f9ea 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -66,6 +66,7 @@ struct builtin_f_type struct type *builtin_character; struct type *builtin_integer; struct type *builtin_integer_s2; + struct type *builtin_integer_s8; struct type *builtin_logical; struct type *builtin_logical_s1; struct type *builtin_logical_s2; diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.fortran/type-kinds.exp index b2e64d77081..129997e4f66 100644 --- a/gdb/testsuite/gdb.fortran/type-kinds.exp +++ b/gdb/testsuite/gdb.fortran/type-kinds.exp @@ -39,6 +39,7 @@ proc test_basic_parsing_of_type_kinds {} { gdb_test "p ((integer (kind=2)) 1)" " = 1" gdb_test "p ((integer (kind=4)) 1)" " = 1" + gdb_test "p ((integer (kind=8)) 1)" " = 1" } proc test_parsing_invalid_type_kinds {} {