gdb/fortran: Add allocatable type qualifier
[external/binutils.git] / gdb / testsuite / gdb.fortran / vla-type.exp
index 68884ce..951f118 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2016 Free Software Foundation, Inc.
+# Copyright 2016-2019 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
 standard_testfile ".f90"
 load_lib "fortran.exp"
 
-if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
      {debug f90 quiet}] } {
     return -1
 }
@@ -33,7 +33,7 @@ set int [fortran_int4]
 # the debugger when accessing it.
 gdb_breakpoint [gdb_get_line_number "before-allocated"]
 gdb_continue_to_breakpoint "before-allocated"
-gdb_test "print twov" " = \\\( <not allocated>, <not allocated> \\\)" \
+gdb_test "print twov" " = \\\( ivla1 = <not allocated>, ivla2 = <not allocated> \\\)" \
   "print twov before allocated"
 gdb_test "print twov%ivla1" " = <not allocated>" \
   "print twov%ivla1 before allocated"
@@ -46,7 +46,7 @@ gdb_test "print onev%ivla(1, 2, 3)" " = 123"
 gdb_test "print onev%ivla(3, 2, 1)" " = 321"
 gdb_test "ptype onev" \
          [multi_line "type = Type one" \
-                     "\\s+$int :: ivla\\\(11,22,33\\\)" \
+                     "\\s+$int, allocatable :: ivla\\\(11,22,33\\\)" \
                      "End Type one" ]
 
 # Check type with two VLA's inside
@@ -57,10 +57,10 @@ gdb_test "print twov%ivla1(1, 2, 3)" " = 123"
 gdb_test "print twov%ivla1(3, 2, 1)" " = 321"
 gdb_test "ptype twov" \
          [multi_line "type = Type two" \
-                     "\\s+$int :: ivla1\\\(5,12,99\\\)" \
-                     "\\s+$int :: ivla2\\\(9,12\\\)" \
+                     "\\s+$int, allocatable :: ivla1\\\(5,12,99\\\)" \
+                     "\\s+$int, allocatable :: ivla2\\\(9,12\\\)" \
                      "End Type two" ]
-gdb_test "print twov" " = \\\( \\\(\\\( \\\( 1, 1, 1, 1, 1\\\)\
+gdb_test "print twov" " = \\\( ivla1 = \\\(\\\( \\\( 1, 1, 1, 1, 1\\\)\
  \\\( 1, 1, 321, 1, 1\\\)\
  \\\( 1, 1, 1, 1, 1\\\) .*"
 
@@ -74,7 +74,7 @@ gdb_test "print threev%ivar" " = 3"
 gdb_test "ptype threev" \
          [multi_line "type = Type three" \
                      "\\s+$int :: ivar" \
-                     "\\s+$int :: ivla\\\(20\\\)" \
+                     "\\s+$int, allocatable :: ivla\\\(20\\\)" \
                      "End Type three" ]
 
 # Check type with attribute at end of type
@@ -87,7 +87,7 @@ gdb_test "print fourv%ivla(12)" "no such vector element"
 gdb_test "print fourv%ivar" " = 3"
 gdb_test "ptype fourv" \
          [multi_line "type = Type four" \
-                     "\\s+$int :: ivla\\\(10\\\)" \
+                     "\\s+$int, allocatable :: ivla\\\(10\\\)" \
                      "\\s+$int :: ivar" \
                      "End Type four" ]
 
@@ -103,7 +103,7 @@ gdb_test "ptype fivev" \
                      "End Type five" ]
 gdb_test "ptype fivev%tone" \
          [multi_line "type = Type one" \
-                     "    $int :: ivla\\(10,10,10\\)" \
+                     "    $int, allocatable :: ivla\\(10,10,10\\)" \
                      "End Type one" ]
 
 # Check array of types containing a VLA
@@ -120,7 +120,7 @@ gdb_test "ptype fivearr(1)" \
                      "End Type five" ]
 gdb_test "ptype fivearr(1)%tone" \
          [multi_line "type = Type one" \
-                     "    $int :: ivla\\(2,4,6\\)" \
+                     "    $int, allocatable :: ivla\\(2,4,6\\)" \
                      "End Type one" ]
 gdb_test "ptype fivearr(2)" \
          [multi_line "type = Type five" \
@@ -128,7 +128,7 @@ gdb_test "ptype fivearr(2)" \
                      "End Type five" ]
 gdb_test "ptype fivearr(2)%tone" \
          [multi_line "type = Type one" \
-                     "    $int :: ivla\\(12,14,16\\)" \
+                     "    $int, allocatable :: ivla\\(12,14,16\\)" \
                      "End Type one" ]
 
 # Check allocation status of dynamic array and it's dynamic members
@@ -141,7 +141,7 @@ gdb_test "ptype fivedynarr(2)" \
          "ptype fivedynarr(2), tone is not allocated"
 gdb_test "ptype fivedynarr(2)%tone" \
          [multi_line "type = Type one" \
-                     "    $int :: ivla\\(<not allocated>\\)" \
+                     "    $int, allocatable :: ivla\\(<not allocated>\\)" \
                      "End Type one" ] \
          "ptype fivedynarr(2)%tone, not allocated"
 
@@ -159,7 +159,7 @@ gdb_test "ptype fivedynarr(1)" \
                      "End Type five" ]
 gdb_test "ptype fivedynarr(1)%tone" \
          [multi_line "type = Type one" \
-                     "    $int :: ivla\\(2,4,6\\)" \
+                     "    $int, allocatable :: ivla\\(2,4,6\\)" \
                      "End Type one" ]
 gdb_test "ptype fivedynarr(2)" \
          [multi_line "type = Type five" \
@@ -167,5 +167,5 @@ gdb_test "ptype fivedynarr(2)" \
                      "End Type five" ]
 gdb_test "ptype fivedynarr(2)%tone" \
          [multi_line "type = Type one" \
-                     "    $int :: ivla\\(12,14,16\\)" \
+                     "    $int, allocatable :: ivla\\(12,14,16\\)" \
                      "End Type one" ]