From patchwork Wed Mar 6 18:15:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 31752 Received: (qmail 37707 invoked by alias); 6 Mar 2019 18:16:08 -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 37606 invoked by uid 89); 6 Mar 2019 18:16:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=BAYES_00, DNS_FROM_AHBL_RHSBL, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.1 spammy=UD:type X-HELO: mail-wr1-f45.google.com Received: from mail-wr1-f45.google.com (HELO mail-wr1-f45.google.com) (209.85.221.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Mar 2019 18:15:40 +0000 Received: by mail-wr1-f45.google.com with SMTP id w17so14497258wrn.12 for ; Wed, 06 Mar 2019 10:15:28 -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=+NS181rQ4C2HijetD2p5thoSG9Utsg4CL0dQUOL3kQg=; b=M8h2/puzGaPIPpjZ9YzY/tbi/pZXxKZee8SBdAwM0pSOwmwh6PSzA+yVWuDgLcrZij y0emr+wt65YmG6Q7n9VC80osq+xOxOw3UjgL1FP+EEQ5JC0uRp9bejKD///mErppfVii d3ffguUOey4BJ1bdQ+KVfk7QUwS8amgyKtJTo4tfdhu1FJ7dw3rLQysdy3c5YyjcfDX1 64xzgJBs5w3OBfvHYqvKsHVIE9NhGp6/Uee1/t48pAIdUOLV/DuU0DAljN6DcpNBRVNy cly5UfcjwVXm9r+Rk+7xh/vtMY0oe8LcMYz9jJpDRFlxg0GIJcJExb1j9oJlm4jdJSVp E17g== Return-Path: Received: from localhost (host86-142-70-198.range86-142.btcentralplus.com. [86.142.70.198]) by smtp.gmail.com with ESMTPSA id g9sm3304600wmf.19.2019.03.06.10.15.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2019 10:15:25 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PUSHED 11/11] gdb/fortran: Handle older TYPE*SIZE typenames Date: Wed, 6 Mar 2019 18:15:04 +0000 Message-Id: <46182f465d064e4c36ebcbab4ecf6e54be2947c3.1551895529.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 b5d4e7b5816..1ae15b96f1a 100644 --- a/gdb/testsuite/gdb.fortran/type-kinds.exp +++ b/gdb/testsuite/gdb.fortran/type-kinds.exp @@ -65,11 +65,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 }