From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14460 invoked by alias); 27 Nov 2018 19:40:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14384 invoked by uid 89); 27 Nov 2018 19:40:18 -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,SPF_FAIL autolearn=ham version=3.3.2 spammy=pc X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Nov 2018 19:40:16 +0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2018 11:40:13 -0800 Received: from ubuntu.imu.intel.com ([10.217.246.11]) by FMSMGA003.fm.intel.com with ESMTP; 27 Nov 2018 11:40:13 -0800 From: Sebastian Basierski To: gdb-patches@sourceware.org Subject: [PATCH 08/11] Fortran: Testsuite, add cyclic pointers. Date: Tue, 27 Nov 2018 19:40:00 -0000 Message-Id: <20181127183139.71170-9-sbasierski@pl.sii.eu> In-Reply-To: <20181127183139.71170-1-sbasierski@pl.sii.eu> References: <20181127183139.71170-1-sbasierski@pl.sii.eu> X-SW-Source: 2018-11/txt/msg00475.txt.bz2 From: Bernhard Heckel 2016-05-25 Bernhard Heckel gdb/testsuite/Changelog: * pointers.f90: Add cylic pointers. * pointers.exp: Add print of cyclic pointers. --- gdb/testsuite/gdb.fortran/pointers.exp | 20 ++++++++++++++++++++ gdb/testsuite/gdb.fortran/pointers.f90 | 12 ++++++++++++ 2 files changed, 32 insertions(+) diff --git a/gdb/testsuite/gdb.fortran/pointers.exp b/gdb/testsuite/gdb.fortran/pointers.exp index 0f6c9d3cdf..287803120a 100644 --- a/gdb/testsuite/gdb.fortran/pointers.exp +++ b/gdb/testsuite/gdb.fortran/pointers.exp @@ -69,6 +69,24 @@ gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) 0x0" \ gdb_test "print *realp" "Cannot access memory at address 0x0" \ "print *realp, not associated" gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" +set test "print cyclicp1, not associated" +gdb_test_multiple "print cyclicp1" $test { + -re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" { + pass $test + } + -re "= \\( i = -?\\d+, p = \\)\r\n$gdb_prompt $" { + pass $test + } +} +set test "print cyclicp1%p, not associated" +gdb_test_multiple "print cyclicp1%p" $test { + -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) 0x0\r\n$gdb_prompt $" { + pass $test + } + -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) \r\n$gdb_prompt $" { + pass $test + } +} gdb_breakpoint [gdb_get_line_number "Before value assignment"] @@ -131,6 +149,8 @@ gdb_test_multiple "print *(arrayOfPtr(3)%p)" $test_name { pass $test_name } } +gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)" +gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer \\)\\) $hex\( <.*>\)?" gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array" gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla" gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\)\\(\\)\\)\\) $hex " \ diff --git a/gdb/testsuite/gdb.fortran/pointers.f90 b/gdb/testsuite/gdb.fortran/pointers.f90 index c36398d76a..1ba5463745 100644 --- a/gdb/testsuite/gdb.fortran/pointers.f90 +++ b/gdb/testsuite/gdb.fortran/pointers.f90 @@ -20,6 +20,11 @@ program pointers integer, allocatable :: ivla2 (:, :) end type two + type :: typeWithPointer + integer i + type(typeWithPointer), pointer:: p + end type typeWithPointer + type :: twoPtr type (two), pointer :: p end type twoPtr @@ -34,6 +39,7 @@ program pointers real, target :: realv type(two), target :: twov type(twoPtr) :: arrayOfPtr (3) + type(typeWithPointer), target:: cyclicp1,cyclicp2 logical, pointer :: logp complex, pointer :: comp @@ -57,6 +63,8 @@ program pointers nullify (arrayOfPtr(1)%p) nullify (arrayOfPtr(2)%p) nullify (arrayOfPtr(3)%p) + nullify (cyclicp1%p) + nullify (cyclicp2%p) logp => logv ! Before pointer assignment comp => comv @@ -68,6 +76,10 @@ program pointers realp => realv twop => twov arrayOfPtr(2)%p => twov + cyclicp1%i = 1 + cyclicp1%p => cyclicp2 + cyclicp2%i = 2 + cyclicp2%p => cyclicp1 logv = associated(logp) ! Before value assignment comv = cmplx(1,2) -- 2.17.1