From patchwork Wed Nov 4 14:54:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 9553 Received: (qmail 99598 invoked by alias); 4 Nov 2015 14:55:09 -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 99494 invoked by uid 89); 4 Nov 2015 14:55:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 04 Nov 2015 14:55:05 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id AC578C0D61C1; Wed, 4 Nov 2015 14:55:03 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA4Et0eR022464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 4 Nov 2015 09:55:02 -0500 Date: Wed, 4 Nov 2015 15:54:59 +0100 From: Jan Kratochvil To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: [commit] [testsuite patch] Fortran: allocate()d memory is uninitialized Message-ID: <20151104145459.GA25454@host1.jankratochvil.net> References: <20151103202214.GA30688@host1.jankratochvil.net> <20151104144017.GG4009@adacore.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151104144017.GG4009@adacore.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Wed, 04 Nov 2015 15:40:17 +0100, Joel Brobecker wrote: > No objection, but I am wondering if it might be better to just > relax instead the regexp to allow any number rather than just > remove the test altogether. The test allows us to verify that, > as soon as we're past the "allocate" call, we no longer say "not > allocated". I agree, adjusted the testcase. Thanks, Jan allocate (vla1 (5)) ! vla1-not-allocated l = allocated(vla1) ! vla1-allocated <------------------ Expecting: ^(510-data-evaluate-expression vla1[^M ]+)?(510\^done,value="\(0, 0, 0, 0, 0\)"[^M ]+[(]gdb[)] ^M [ ]*) 510-data-evaluate-expression vla1^M 510^done,value="(1.82987403e-09, 7.8472714e-44, 1.82987403e-09, 7.8472714e-44, 2.67929926e+20)"^M (gdb) ^M FAIL: gdb.mi/mi-vla-fortran.exp: evaluate allocated vla gcc-4.9.2-6.fc21.x86_64 I think some older gfortran did initialize allocated memory but that is an unspecified behavior. I haven't found any initialization mentioned in Fortran 90 standard (draft) and it is also clearly stated here: https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/268786 Initialization to 0 of allocated arrays (of integers) is an implementation issue. i.e. do not rely on it. Joel Brobecker wrote: I am wondering if it might be better to just relax instead the regexp to allow any number rather than just remove the test altogether. The test allows us to verify that, as soon as we're past the "allocate" call, we no longer say "not allocated". gdb/testsuite/ChangeLog 2015-11-03 Jan Kratochvil Joel Brobecker * gdb.mi/mi-vla-fortran.exp (evaluate allocated vla): Permit any data. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.mi/mi-vla-fortran.exp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6d70c76..3476c86 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-11-03 Jan Kratochvil + Joel Brobecker + + * gdb.mi/mi-vla-fortran.exp (evaluate allocated vla): Permit any data. + 2015-11-04 Marcin Kościelnicki * gdb.reverse/s390-mvcle.c: New test. diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp index d191623..8902ecb 100644 --- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp @@ -69,7 +69,7 @@ mi_run_cmd mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" mi_gdb_test "510-data-evaluate-expression vla1" \ - "510\\^done,value=\"\\(0, 0, 0, 0, 0\\)\"" "evaluate allocated vla" + "510\\^done,value=\"\\(.*\\)\"" "evaluate allocated vla" mi_create_varobj_checked vla1_allocated vla1 "real\\\(kind=4\\\) \\\(5\\\)" \ "create local variable vla1_allocated"