|
|
190f2a |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
190f2a |
From: Fedora GDB patches <invalid@email.com>
|
|
|
190f2a |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
190f2a |
Subject: gdb-vla-intel-tests.patch
|
|
|
190f2a |
|
|
|
190f2a |
;;=fedoratest
|
|
|
190f2a |
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.fortran/vla-func.exp
|
|
|
190f2a |
@@ -0,0 +1,61 @@
|
|
|
190f2a |
+# Copyright 2014 Free Software Foundation, Inc.
|
|
|
190f2a |
+
|
|
|
190f2a |
+# This program is free software; you can redistribute it and/or modify
|
|
|
190f2a |
+# it under the terms of the GNU General Public License as published by
|
|
|
190f2a |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
190f2a |
+# (at your option) any later version.
|
|
|
190f2a |
+#
|
|
|
190f2a |
+# This program is distributed in the hope that it will be useful,
|
|
|
190f2a |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
190f2a |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
190f2a |
+# GNU General Public License for more details.
|
|
|
190f2a |
+#
|
|
|
190f2a |
+# You should have received a copy of the GNU General Public License
|
|
|
190f2a |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
190f2a |
+
|
|
|
190f2a |
+standard_testfile ".f90"
|
|
|
190f2a |
+
|
|
|
190f2a |
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
|
|
|
190f2a |
+ {debug f90 quiet}] } {
|
|
|
190f2a |
+ return -1
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+if ![runto MAIN__] then {
|
|
|
190f2a |
+ perror "couldn't run to breakpoint MAIN__"
|
|
|
190f2a |
+ continue
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+# Check VLA passed to first Fortran function.
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "func1-vla-passed"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "func1-vla-passed"
|
|
|
190f2a |
+gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \
|
|
|
190f2a |
+ "print vla (func1)"
|
|
|
190f2a |
+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10,10\\\)" \
|
|
|
190f2a |
+ "ptype vla (func1)"
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "func1-vla-modified"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "func1-vla-modified"
|
|
|
190f2a |
+gdb_test "print vla(5,5)" " = 55" "print vla(5,5) (func1)"
|
|
|
190f2a |
+gdb_test "print vla(7,7)" " = 77" "print vla(5,5) (func1)"
|
|
|
190f2a |
+
|
|
|
190f2a |
+# Check if the values are correct after returning from func1
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "func1-returned"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "func1-returned"
|
|
|
190f2a |
+gdb_test "print ret" " = .TRUE." "print ret after func1 returned"
|
|
|
190f2a |
+
|
|
|
190f2a |
+# Check VLA passed to second Fortran function
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "func2-vla-passed"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "func2-vla-passed"
|
|
|
190f2a |
+gdb_test "print vla" \
|
|
|
190f2a |
+ " = \\\(44, 44, 44, 44, 44, 44, 44, 44, 44, 44\\\)" \
|
|
|
190f2a |
+ "print vla (func2)"
|
|
|
190f2a |
+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
|
|
|
190f2a |
+ "ptype vla (func2)"
|
|
|
190f2a |
+
|
|
|
190f2a |
+# Check if the returned VLA has the correct values and ptype.
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "func2-returned"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "func2-returned"
|
|
|
190f2a |
+gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \
|
|
|
190f2a |
+ "print vla3 (after func2)"
|
|
|
190f2a |
+gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \
|
|
|
190f2a |
+ "ptype vla3 (after func2)"
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.fortran/vla-func.f90
|
|
|
190f2a |
@@ -0,0 +1,71 @@
|
|
|
190f2a |
+! Copyright 2014 Free Software Foundation, Inc.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! This program is free software; you can redistribute it and/or modify
|
|
|
190f2a |
+! it under the terms of the GNU General Public License as published by
|
|
|
190f2a |
+! the Free Software Foundation; either version 2 of the License, or
|
|
|
190f2a |
+! (at your option) any later version.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! This program is distributed in the hope that it will be useful,
|
|
|
190f2a |
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
190f2a |
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
190f2a |
+! GNU General Public License for more details.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! You should have received a copy of the GNU General Public License
|
|
|
190f2a |
+! along with this program; if not, write to the Free Software
|
|
|
190f2a |
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
190f2a |
+
|
|
|
190f2a |
+logical function func1 (vla)
|
|
|
190f2a |
+ implicit none
|
|
|
190f2a |
+ integer, allocatable :: vla (:, :)
|
|
|
190f2a |
+ func1 = allocated(vla)
|
|
|
190f2a |
+ vla(5,5) = 55 ! func1-vla-passed
|
|
|
190f2a |
+ vla(7,7) = 77
|
|
|
190f2a |
+ return ! func1-vla-modified
|
|
|
190f2a |
+end function func1
|
|
|
190f2a |
+
|
|
|
190f2a |
+function func2(vla)
|
|
|
190f2a |
+ implicit none
|
|
|
190f2a |
+ integer :: vla (:)
|
|
|
190f2a |
+ integer :: func2(size(vla))
|
|
|
190f2a |
+ integer :: k
|
|
|
190f2a |
+
|
|
|
190f2a |
+ vla(1) = 1 ! func2-vla-passed
|
|
|
190f2a |
+ vla(2) = 2
|
|
|
190f2a |
+ vla(4) = 4
|
|
|
190f2a |
+ vla(8) = 8
|
|
|
190f2a |
+
|
|
|
190f2a |
+ func2 = vla
|
|
|
190f2a |
+end function func2
|
|
|
190f2a |
+
|
|
|
190f2a |
+program vla_func
|
|
|
190f2a |
+ implicit none
|
|
|
190f2a |
+ interface
|
|
|
190f2a |
+ logical function func1 (vla)
|
|
|
190f2a |
+ integer, allocatable :: vla (:, :)
|
|
|
190f2a |
+ end function
|
|
|
190f2a |
+ end interface
|
|
|
190f2a |
+ interface
|
|
|
190f2a |
+ function func2 (vla)
|
|
|
190f2a |
+ integer :: vla (:)
|
|
|
190f2a |
+ integer func2(size(vla))
|
|
|
190f2a |
+ end function
|
|
|
190f2a |
+ end interface
|
|
|
190f2a |
+
|
|
|
190f2a |
+ logical :: ret
|
|
|
190f2a |
+ integer, allocatable :: vla1 (:, :)
|
|
|
190f2a |
+ integer, allocatable :: vla2 (:)
|
|
|
190f2a |
+ integer, allocatable :: vla3 (:)
|
|
|
190f2a |
+
|
|
|
190f2a |
+ ret = .FALSE.
|
|
|
190f2a |
+
|
|
|
190f2a |
+ allocate (vla1 (10,10))
|
|
|
190f2a |
+ vla1(:,:) = 22
|
|
|
190f2a |
+
|
|
|
190f2a |
+ allocate (vla2 (10))
|
|
|
190f2a |
+ vla2(:) = 44
|
|
|
190f2a |
+
|
|
|
190f2a |
+ ret = func1(vla1)
|
|
|
190f2a |
+ vla3 = func2(vla2) ! func1-returned
|
|
|
190f2a |
+
|
|
|
190f2a |
+ ret = .TRUE. ! func2-returned
|
|
|
190f2a |
+end program vla_func
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.exp
|
|
|
190f2a |
@@ -0,0 +1,101 @@
|
|
|
190f2a |
+# Copyright 2014 Free Software Foundation, Inc.
|
|
|
190f2a |
+
|
|
|
190f2a |
+# This program is free software; you can redistribute it and/or modify
|
|
|
190f2a |
+# it under the terms of the GNU General Public License as published by
|
|
|
190f2a |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
190f2a |
+# (at your option) any later version.
|
|
|
190f2a |
+#
|
|
|
190f2a |
+# This program is distributed in the hope that it will be useful,
|
|
|
190f2a |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
190f2a |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
190f2a |
+# GNU General Public License for more details.
|
|
|
190f2a |
+#
|
|
|
190f2a |
+# You should have received a copy of the GNU General Public License
|
|
|
190f2a |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
190f2a |
+
|
|
|
190f2a |
+standard_testfile ".f90"
|
|
|
190f2a |
+
|
|
|
190f2a |
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
|
|
|
190f2a |
+ {debug f90 quiet}] } {
|
|
|
190f2a |
+ return -1
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+# check that all fortran standard datatypes will be
|
|
|
190f2a |
+# handled correctly when using as VLA's
|
|
|
190f2a |
+
|
|
|
190f2a |
+if ![runto MAIN__] then {
|
|
|
190f2a |
+ perror "couldn't run to breakpoint MAIN__"
|
|
|
190f2a |
+ continue
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "var_char-allocated-1"
|
|
|
190f2a |
+gdb_test "print var_char" \
|
|
|
190f2a |
+ " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \
|
|
|
190f2a |
+ "print var_char after allocated first time"
|
|
|
190f2a |
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \
|
|
|
190f2a |
+ "whatis var_char first time"
|
|
|
190f2a |
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \
|
|
|
190f2a |
+ "ptype var_char first time"
|
|
|
190f2a |
+gdb_test "next" "\\d+.*var_char = 'foo'.*" \
|
|
|
190f2a |
+ "next to allocation status of var_char"
|
|
|
190f2a |
+gdb_test "print l" " = .TRUE." "print allocation status first time"
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "var_char-filled-1"
|
|
|
190f2a |
+gdb_test "print var_char" \
|
|
|
190f2a |
+ " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \
|
|
|
190f2a |
+ "print var_char after filled first time"
|
|
|
190f2a |
+gdb_test "print *var_char" " = 'foo'" \
|
|
|
190f2a |
+ "print *var_char after filled first time"
|
|
|
190f2a |
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \
|
|
|
190f2a |
+ "whatis var_char after filled first time"
|
|
|
190f2a |
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \
|
|
|
190f2a |
+ "ptype var_char after filled first time"
|
|
|
190f2a |
+gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
|
|
|
190f2a |
+gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "var_char-filled-2"
|
|
|
190f2a |
+gdb_test "print var_char" \
|
|
|
190f2a |
+ " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \
|
|
|
190f2a |
+ "print var_char after allocated second time"
|
|
|
190f2a |
+gdb_test "print *var_char" " = 'foobar'" \
|
|
|
190f2a |
+ "print *var_char after allocated second time"
|
|
|
190f2a |
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \
|
|
|
190f2a |
+ "whatis var_char second time"
|
|
|
190f2a |
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \
|
|
|
190f2a |
+ "ptype var_char second time"
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "var_char-empty"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "var_char-empty"
|
|
|
190f2a |
+gdb_test "print var_char" \
|
|
|
190f2a |
+ " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \
|
|
|
190f2a |
+ "print var_char after set empty"
|
|
|
190f2a |
+gdb_test "print *var_char" " = \"\"" "print *var_char after set empty"
|
|
|
190f2a |
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \
|
|
|
190f2a |
+ "whatis var_char after set empty"
|
|
|
190f2a |
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \
|
|
|
190f2a |
+ "ptype var_char after set empty"
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "var_char-allocated-3"
|
|
|
190f2a |
+gdb_test "print var_char" \
|
|
|
190f2a |
+ " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \
|
|
|
190f2a |
+ "print var_char after allocated third time"
|
|
|
190f2a |
+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \
|
|
|
190f2a |
+ "whatis var_char after allocated third time"
|
|
|
190f2a |
+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \
|
|
|
190f2a |
+ "ptype var_char after allocated third time"
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_breakpoint [gdb_get_line_number "var_char_p-associated"]
|
|
|
190f2a |
+gdb_continue_to_breakpoint "var_char_p-associated"
|
|
|
190f2a |
+gdb_test "print var_char_p" \
|
|
|
190f2a |
+ " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \
|
|
|
190f2a |
+ "print var_char_p after associated"
|
|
|
190f2a |
+gdb_test "print *var_char_p" " = 'johndoe'" \
|
|
|
190f2a |
+ "print *var_char_ after associated"
|
|
|
190f2a |
+gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
|
|
|
190f2a |
+ "whatis var_char_p after associated"
|
|
|
190f2a |
+gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \
|
|
|
190f2a |
+ "ptype var_char_p after associated"
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.f90 b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.fortran/vla-stringsold.f90
|
|
|
190f2a |
@@ -0,0 +1,40 @@
|
|
|
190f2a |
+! Copyright 2014 Free Software Foundation, Inc.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! This program is free software; you can redistribute it and/or modify
|
|
|
190f2a |
+! it under the terms of the GNU General Public License as published by
|
|
|
190f2a |
+! the Free Software Foundation; either version 2 of the License, or
|
|
|
190f2a |
+! (at your option) any later version.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! This program is distributed in the hope that it will be useful,
|
|
|
190f2a |
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
190f2a |
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
190f2a |
+! GNU General Public License for more details.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! You should have received a copy of the GNU General Public License
|
|
|
190f2a |
+! along with this program; if not, write to the Free Software
|
|
|
190f2a |
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
190f2a |
+
|
|
|
190f2a |
+program vla_strings
|
|
|
190f2a |
+ character(len=:), target, allocatable :: var_char
|
|
|
190f2a |
+ character(len=:), pointer :: var_char_p
|
|
|
190f2a |
+ logical :: l
|
|
|
190f2a |
+
|
|
|
190f2a |
+ allocate(character(len=10) :: var_char)
|
|
|
190f2a |
+ l = allocated(var_char) ! var_char-allocated-1
|
|
|
190f2a |
+ var_char = 'foo'
|
|
|
190f2a |
+ deallocate(var_char) ! var_char-filled-1
|
|
|
190f2a |
+ l = allocated(var_char) ! var_char-deallocated
|
|
|
190f2a |
+ allocate(character(len=42) :: var_char)
|
|
|
190f2a |
+ l = allocated(var_char)
|
|
|
190f2a |
+ var_char = 'foobar'
|
|
|
190f2a |
+ var_char = '' ! var_char-filled-2
|
|
|
190f2a |
+ var_char = 'bar' ! var_char-empty
|
|
|
190f2a |
+ deallocate(var_char)
|
|
|
190f2a |
+ allocate(character(len=21) :: var_char)
|
|
|
190f2a |
+ l = allocated(var_char) ! var_char-allocated-3
|
|
|
190f2a |
+ var_char = 'johndoe'
|
|
|
190f2a |
+ var_char_p => var_char
|
|
|
190f2a |
+ l = associated(var_char_p) ! var_char_p-associated
|
|
|
190f2a |
+ var_char_p => null()
|
|
|
190f2a |
+ l = associated(var_char_p) ! var_char_p-not-associated
|
|
|
190f2a |
+end program vla_strings
|