From patchwork Tue Nov 3 20:22:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 9546 Received: (qmail 76889 invoked by alias); 3 Nov 2015 20:22:21 -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 76787 invoked by uid 89); 3 Nov 2015 20:22:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_05, 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; Tue, 03 Nov 2015 20:22:19 +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 7759F96D8 for ; Tue, 3 Nov 2015 20:22:18 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA3KMFfc017617 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 3 Nov 2015 15:22:17 -0500 Date: Tue, 3 Nov 2015 21:22:14 +0100 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [testsuite patch] Fortran: allocate()d memory is uninitialized Message-ID: <20151103202214.GA30688@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, 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. OK for check-in? Jan gdb/testsuite/ChangeLog 2015-11-03 Jan Kratochvil * gdb.mi/mi-vla-fortran.exp (evaluate allocated vla): Remove test. diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp index d191623..baee7f8 100644 --- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp @@ -68,8 +68,6 @@ mi_create_breakpoint "-t vla.f90:$bp_lineno" 2 "del" "vla" ".*vla.f90" \ 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" mi_create_varobj_checked vla1_allocated vla1 "real\\\(kind=4\\\) \\\(5\\\)" \ "create local variable vla1_allocated"