This is the mail archive of the
mailing list for the GDB project.
Re: [testsuite patch] Fortran: allocate()d memory is uninitialized
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 4 Nov 2015 06:40:17 -0800
- Subject: Re: [testsuite patch] Fortran: allocate()d memory is uninitialized
- Authentication-results: sourceware.org; auth=none
- References: <20151103202214 dot GA30688 at host1 dot jankratochvil dot net>
On Tue, Nov 03, 2015 at 09:22:14PM +0100, Jan Kratochvil wrote:
> 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
> 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:
> Initialization to 0 of allocated arrays (of integers) is an
> implementation issue. i.e. do not rely on it.
> OK for check-in?
> 2015-11-03 Jan Kratochvil <email@example.com>
> * gdb.mi/mi-vla-fortran.exp (evaluate allocated vla): Remove test.
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
Your choice, though. I really don't know Fortran at all...