|
| 1 | +# Copyright 2014 Free Software Foundation, Inc. |
| 2 | + |
| 3 | +# This program is free software; you can redistribute it and/or modify |
| 4 | +# it under the terms of the GNU General Public License as published by |
| 5 | +# the Free Software Foundation; either version 3 of the License, or |
| 6 | +# (at your option) any later version. |
| 7 | +# |
| 8 | +# This program is distributed in the hope that it will be useful, |
| 9 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | +# GNU General Public License for more details. |
| 12 | +# |
| 13 | +# You should have received a copy of the GNU General Public License |
| 14 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | + |
| 16 | +standard_testfile ".f90" |
| 17 | + |
| 18 | +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ |
| 19 | + {debug f90 quiet}] } { |
| 20 | + return -1 |
| 21 | +} |
| 22 | + |
| 23 | +# check that all fortran standard datatypes will be |
| 24 | +# handled correctly when using as VLA's |
| 25 | + |
| 26 | +if ![runto MAIN__] then { |
| 27 | + perror "couldn't run to breakpoint MAIN__" |
| 28 | + continue |
| 29 | +} |
| 30 | + |
| 31 | +gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"] |
| 32 | +gdb_continue_to_breakpoint "var_char-allocated-1" |
| 33 | +gdb_test "print var_char" \ |
| 34 | + " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \ |
| 35 | + "print var_char after allocated first time" |
| 36 | +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \ |
| 37 | + "whatis var_char first time" |
| 38 | +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \ |
| 39 | + "ptype var_char first time" |
| 40 | +gdb_test "next" "\\d+.*var_char = 'foo'.*" \ |
| 41 | + "next to allocation status of var_char" |
| 42 | +gdb_test "print l" " = .TRUE." "print allocation status first time" |
| 43 | + |
| 44 | +gdb_breakpoint [gdb_get_line_number "var_char-filled-1"] |
| 45 | +gdb_continue_to_breakpoint "var_char-filled-1" |
| 46 | +gdb_test "print var_char" \ |
| 47 | + " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \ |
| 48 | + "print var_char after filled first time" |
| 49 | +gdb_test "print *var_char" " = 'foo'" \ |
| 50 | + "print *var_char after filled first time" |
| 51 | +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \ |
| 52 | + "whatis var_char after filled first time" |
| 53 | +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \ |
| 54 | + "ptype var_char after filled first time" |
| 55 | +gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)" |
| 56 | +gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)" |
| 57 | + |
| 58 | +gdb_breakpoint [gdb_get_line_number "var_char-filled-2"] |
| 59 | +gdb_continue_to_breakpoint "var_char-filled-2" |
| 60 | +gdb_test "print var_char" \ |
| 61 | + " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \ |
| 62 | + "print var_char after allocated second time" |
| 63 | +gdb_test "print *var_char" " = 'foobar'" \ |
| 64 | + "print *var_char after allocated second time" |
| 65 | +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \ |
| 66 | + "whatis var_char second time" |
| 67 | +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \ |
| 68 | + "ptype var_char second time" |
| 69 | + |
| 70 | +gdb_breakpoint [gdb_get_line_number "var_char-empty"] |
| 71 | +gdb_continue_to_breakpoint "var_char-empty" |
| 72 | +gdb_test "print var_char" \ |
| 73 | + " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \ |
| 74 | + "print var_char after set empty" |
| 75 | +gdb_test "print *var_char" " = \"\"" "print *var_char after set empty" |
| 76 | +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \ |
| 77 | + "whatis var_char after set empty" |
| 78 | +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \ |
| 79 | + "ptype var_char after set empty" |
| 80 | + |
| 81 | +gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"] |
| 82 | +gdb_continue_to_breakpoint "var_char-allocated-3" |
| 83 | +gdb_test "print var_char" \ |
| 84 | + " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \ |
| 85 | + "print var_char after allocated third time" |
| 86 | +gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \ |
| 87 | + "whatis var_char after allocated third time" |
| 88 | +gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \ |
| 89 | + "ptype var_char after allocated third time" |
| 90 | + |
| 91 | +gdb_breakpoint [gdb_get_line_number "var_char_p-associated"] |
| 92 | +gdb_continue_to_breakpoint "var_char_p-associated" |
| 93 | +gdb_test "print var_char_p" \ |
| 94 | + " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \ |
| 95 | + "print var_char_p after associated" |
| 96 | +gdb_test "print *var_char_p" " = 'johndoe'" \ |
| 97 | + "print *var_char_ after associated" |
| 98 | +gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ |
| 99 | + "whatis var_char_p after associated" |
| 100 | +gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ |
| 101 | + "ptype var_char_p after associated" |
0 commit comments