From patchwork Wed May 15 21:30:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 32702 Received: (qmail 84626 invoked by alias); 15 May 2019 21:30:56 -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 84450 invoked by uid 89); 15 May 2019 21:30:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=AWL, 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.1 spammy= X-HELO: mail-wr1-f44.google.com Received: from mail-wr1-f44.google.com (HELO mail-wr1-f44.google.com) (209.85.221.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 15 May 2019 21:30:21 +0000 Received: by mail-wr1-f44.google.com with SMTP id d9so1090628wrx.0 for ; Wed, 15 May 2019 14:30:15 -0700 (PDT) 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; bh=XvPLxkseq9ZRVEoNTfQ7AzN1P96nL0iuNe04dEQD+24=; b=S/yPUfo3nLPMMSq3MEpfr3pEzhgtKz0ZnfZZ7nbvJGhs0QTTz317g6YcfN4fxkUCGw mllxLml+ODial/v7Ai7lXwc6JR7GbaIcLglKdPej6m3/0AA4MfNRvhpeJ8eboKxBBttR /rUalG5+LWxblwc93OMaiyk2fUvq8ZAwH9jJXJtMsN2/mM9egXKPPPMLuu+uys9VpHyU C6wD8rMFR0bgkYJwRbJDcYJdu9arIDYgvgtzCf6qy2oeDJttOWDEOA9yjRv5E0S9iigq 3H+uIkkcPl3TrZJNhOi18K6jQyosLer2hbAm0/trCDXJeO7Rb+4gioeA3IgM5aztuBh9 YgvQ== Return-Path: Received: from localhost (host86-180-62-212.range86-180.btcentralplus.com. [86.180.62.212]) by smtp.gmail.com with ESMTPSA id y132sm5675259wmd.35.2019.05.15.14.30.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2019 14:30:12 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PUSHED] gdb/fortran: Add sizeof tests for indexed and sliced arrays Date: Wed, 15 May 2019 22:30:09 +0100 Message-Id: <20190515213009.23058-1-andrew.burgess@embecosm.com> In-Reply-To: <20181127183139.71170-12-sbasierski@pl.sii.eu> References: <20181127183139.71170-12-sbasierski@pl.sii.eu> X-IsSubscribed: yes I've pushed the below. Thanks, Andrew --- Add tests for calling sizeof on indexed and sliced arrays, and on pointers to arrays. These are all things that currently work, but were previously untested. gdb/testsuite/ChangeLog: * gdb.fortran/vla-sizeof.exp: Add tests of sizeof applied to indexed and sliced arrays, and pointers to arrays. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.fortran/vla-sizeof.exp | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp index 7f74a699d76..b6fdaebbf51 100644 --- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp +++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp @@ -29,18 +29,33 @@ if ![runto_main] { gdb_breakpoint [gdb_get_line_number "vla1-init"] gdb_continue_to_breakpoint "vla1-init" gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1" +gdb_test "print sizeof(vla1(3,2,1))" \ + "no such vector element \\(vector not allocated\\)" \ + "print sizeof non-allocated indexed vla1" +gdb_test "print sizeof(vla1(3:4,2,1))" "slice out of range" \ + "print sizeof non-allocated sliced vla1" # Try to access value in allocated VLA -gdb_breakpoint [gdb_get_line_number "vla2-allocated"] -gdb_continue_to_breakpoint "vla2-allocated" +gdb_breakpoint [gdb_get_line_number "vla1-allocated"] +gdb_continue_to_breakpoint "vla1-allocated" gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1" +gdb_test "print sizeof(vla1(3,2,1))" "4" \ + "print sizeof element from allocated vla1" +gdb_test "print sizeof(vla1(3:4,2,1))" "800" \ + "print sizeof sliced vla1" # Try to access values in undefined pointer to VLA (dangling) -gdb_breakpoint [gdb_get_line_number "vla1-filled"] -gdb_continue_to_breakpoint "vla1-filled" gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla" +gdb_test "print sizeof(pvla(3,2,1))" \ + "no such vector element \\(vector not associated\\)" \ + "print sizeof non-associated indexed pvla" +gdb_test "print sizeof(pvla(3:4,2,1))" "slice out of range" \ + "print sizeof non-associated sliced pvla" # Try to access values in pointer to VLA and compare them gdb_breakpoint [gdb_get_line_number "pvla-associated"] gdb_continue_to_breakpoint "pvla-associated" gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla" +gdb_test "print sizeof(pvla(3,2,1))" "4" \ + "print sizeof element from associated pvla" +gdb_test "print sizeof(pvla(3:4,2,1))" "800" "print sizeof sliced pvla"