Blame SOURCES/gdb-vla-intel-tests.patch

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