From patchwork Tue Feb 12 16:11:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 31420 Received: (qmail 68875 invoked by alias); 12 Feb 2019 16:11:28 -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 68786 invoked by uid 89); 12 Feb 2019 16:11:27 -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-f48.google.com Received: from mail-wr1-f48.google.com (HELO mail-wr1-f48.google.com) (209.85.221.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Feb 2019 16:11:25 +0000 Received: by mail-wr1-f48.google.com with SMTP id r2so3273976wrv.10 for ; Tue, 12 Feb 2019 08:11:25 -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=1F5JCRvwHowmBMc2XLanWAMOG21iBALTLyJRi6iXeeo=; b=AITY78CkqhPN3ks4/cbSTdDwcManPx6pq0rH9PMcHS0jyJKcwYok/KmjukiPuE2IB9 S6QSjojP/U9cYkqy8H2jNY4N0uLrTu5X5J9Y2m5NNa35F1ZlpUG+ydrBTuKpIMbZVsXi CUcbby5zd0SUFN4PRZ3xWpdMboVgCQsuYrHwV5/ud9P+UiuQJmWboc3cQGwH2uPqdc0u YFCjKBqxyhbHZydec3qVX/JmWFZGywbvQgbxShBP9WY5S+EQxNeEtfKzyL2KvIH6rXxL Nf7bYwfEmwqYdRoDi1fmzx9Bcjd07/eokQS0B0hvBkl3O6NEuBzpEp0myeuXxfm3mcLw 4Rcg== Return-Path: Received: from localhost (host81-151-161-9.range81-151.btcentralplus.com. [81.151.161.9]) by smtp.gmail.com with ESMTPSA id u75sm4299846wmu.15.2019.02.12.08.11.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 08:11:22 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Richard Bunt , Andrew Burgess Subject: [PATCH 11/11] gdb/fortran: Handle older TYPE*SIZE typenames Date: Tue, 12 Feb 2019 16:11:02 +0000 Message-Id: <6ca66dbf3679496540ac7892963b75aed9756a3c.1549986233.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes This patch adds support for the older TYPE*SIZE typenames that are still around in older code. For implementation this currently reuses the kind mechanism, as under gFortran the kind number is equivalent to the size, however, this is not necessarily true for all compilers. If the rules for other compilers are better understood then this code might need to be improved slightly to allow for a distinction between size and kind, however, adding this extra complexity now seems pointless. gdb/ChangeLog: * f-exp.y (direct_abs_decl): Handle TYPE*SIZE type names. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp: Extend to cover TYPE*SIZE cases. --- gdb/ChangeLog | 4 ++++ gdb/f-exp.y | 2 ++ gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.fortran/type-kinds.exp | 23 +++++++++++++++++++++++ 4 files changed, 33 insertions(+) diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 88c685a0af3..7e838b0a93a 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -570,6 +570,8 @@ direct_abs_decl: '(' abs_decl ')' { $$ = $2; } | '(' KIND '=' INT ')' { push_kind_type ($4.val, $4.type); } + | '*' INT + { push_kind_type ($2.val, $2.type); } | direct_abs_decl func_mod { push_type (tp_function); } | func_mod diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.fortran/type-kinds.exp index 0daa1ec6b12..291749a1541 100644 --- a/gdb/testsuite/gdb.fortran/type-kinds.exp +++ b/gdb/testsuite/gdb.fortran/type-kinds.exp @@ -50,11 +50,34 @@ proc test_parsing_invalid_type_kinds {} { } } +# Perform some basic checks that GDB can parse the older style +# TYPE*SIZE type names. +proc test_old_star_type_sizes {} { + gdb_test "p ((character*1) 1)" " = 1 '\\\\001'" + + gdb_test "p ((complex*4) 1)" " = \\(1,0\\)" + gdb_test "p ((complex*8) 1)" " = \\(1,0\\)" + gdb_test "p ((complex*16) 1)" " = \\(1,0\\)" + + gdb_test "p ((real*4) 1)" " = 1" + gdb_test "p ((real*8) 1)" " = 1" + gdb_test "p ((real*16) 1)" " = 1" + + gdb_test "p ((logical*1) 1)" " = \\.TRUE\\." + gdb_test "p ((logical*4) 1)" " = \\.TRUE\\." + gdb_test "p ((logical*8) 1)" " = \\.TRUE\\." + + gdb_test "p ((integer*2) 1)" " = 1" + gdb_test "p ((integer*4) 1)" " = 1" + gdb_test "p ((integer*8) 1)" " = 1" +} + clean_restart if [set_lang_fortran] then { test_basic_parsing_of_type_kinds test_parsing_invalid_type_kinds + test_old_star_type_sizes } else { warning "$test_name tests suppressed." 0 }