aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2015-11-04 15:52:41 +0100
committerJan Kratochvil <jan.kratochvil@redhat.com>2015-11-04 15:52:41 +0100
commit6f2f1a3a706e56b3fddd7ab1fc9a313343c85d4a (patch)
treeaccb4a63416e3b445ccb19bd6c63e6e6604e51b7 /gdb
parent6df55226405d626059f81bec3078a70db41dec9f (diff)
downloadgdb-6f2f1a3a706e56b3fddd7ab1fc9a313343c85d4a.zip
gdb-6f2f1a3a706e56b3fddd7ab1fc9a313343c85d4a.tar.gz
gdb-6f2f1a3a706e56b3fddd7ab1fc9a313343c85d4a.tar.bz2
Fortran: allocate()d memory is uninitialized
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 <jan.kratochvil@redhat.com> Joel Brobecker <brobecker@adacore.com> * gdb.mi/mi-vla-fortran.exp (evaluate allocated vla): Permit any data.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.mi/mi-vla-fortran.exp2
2 files changed, 6 insertions, 1 deletions
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 <jan.kratochvil@redhat.com>
+ Joel Brobecker <brobecker@adacore.com>
+
+ * gdb.mi/mi-vla-fortran.exp (evaluate allocated vla): Permit any data.
+
2015-11-04 Marcin Koƛcielnicki <koriakin@0x04.net>
* 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"