URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/gnu-old/gdb-7.1/gdb/testsuite/gdb.fortran
- from Rev 227 to Rev 816
- ↔ Reverse comparison
Rev 227 → Rev 816
/types.exp
0,0 → 1,114
# Copyright 1994, 1995, 1997, 1998, 2007, 2008, 2009, 2010 |
# 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 |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# This file was adapted from old Chill tests by Stan Shebs |
# (shebs@cygnus.com). |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
if { [skip_fortran_tests] } { continue } |
|
set prms_id 0 |
set bug_id 0 |
|
# Set the current language to fortran. This counts as a test. If it |
# fails, then we skip the other tests. |
|
proc set_lang_fortran {} { |
global gdb_prompt |
|
if [gdb_test "set language fortran" ""] { |
return 0; |
} |
|
if ![gdb_test "show language" ".* source language is \"fortran\".*"] { |
return 1; |
} else { |
return 0; |
} |
} |
|
proc test_integer_literal_types_accepted {} { |
global gdb_prompt |
|
# Test various decimal values. |
# Should be integer*4 probably. |
gdb_test "pt 123" "type = int" |
} |
|
proc test_character_literal_types_accepted {} { |
global gdb_prompt |
|
# Test various character values. |
|
gdb_test "pt 'a'" "type = character\\*1" |
} |
|
proc test_integer_literal_types_rejected {} { |
global gdb_prompt |
|
test_print_reject "pt _" |
} |
|
proc test_logical_literal_types_accepted {} { |
global gdb_prompt |
|
# Test the only possible values for a logical, TRUE and FALSE. |
|
gdb_test "pt .TRUE." "type = logical\\*2" |
gdb_test "pt .FALSE." "type = logical\\*2" |
} |
|
proc test_float_literal_types_accepted {} { |
global gdb_prompt |
|
# Test various floating point formats |
|
# this used to guess whether to look for "real*4" or |
# "real*8" based on a target config variable, but noone |
# maintained it properly. |
|
gdb_test "pt .44" "type = real\\*\[0-9\]+" |
gdb_test "pt 44.0" "type = real\\*\[0-9\]+" |
gdb_test "pt 10D20" "type = real\\*\[0-9\]+" |
gdb_test "pt 10D20" "type = real\\*\[0-9\]+" |
gdb_test "pt 10d20" "type = real\\*\[0-9\]+" |
gdb_test "pt 10d20" "type = real\\*\[0-9\]+" |
gdb_test "pt 10E20" "type = real\\*\[0-9\]+" |
gdb_test "pt 10E20" "type = real\\*\[0-9\]+" |
gdb_test "pt 10e20" "type = real\\*\[0-9\]+" |
gdb_test "pt 10e20" "type = real\\*\[0-9\]+" |
} |
|
# Start with a fresh gdb. |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
|
gdb_test "set print sevenbit-strings" "" |
|
if [set_lang_fortran] then { |
test_integer_literal_types_accepted |
test_integer_literal_types_rejected |
test_logical_literal_types_accepted |
test_character_literal_types_accepted |
test_float_literal_types_accepted |
} else { |
warning "$test_name tests suppressed." 0 |
} |
/array-element.exp
0,0 → 1,60
# Copyright 2005, 2007, 2008, 2009, 2010 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 |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# This file was written by Wu Zhou. (woodzltc@cn.ibm.com) |
|
# This file is part of the gdb testsuite. It contains test for printing |
# the elements of an array which is passed as pointer to a subroutine. |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
if { [skip_fortran_tests] } { return -1 } |
|
set testfile "array-element" |
set srcfile ${testfile}.f |
set binfile ${objdir}/${subdir}/${testfile} |
|
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ |
executable {debug f77}] != ""} { |
return -1 |
} |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
gdb_load ${binfile} |
|
if ![runto sub_] then { |
perror "couldn't run to breakpoint sub_" |
continue |
} |
|
set bp_location [gdb_get_line_number "continue"] |
gdb_test "break $bp_location" \ |
"Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \ |
"breakpoint at continue" |
|
gdb_test "continue" \ |
"Continuing\\..*Breakpoint.*" \ |
"continue to breakpoint" |
gdb_test "print a(1)" ".*1 = 1.*" "print the first element of array a" |
|
gdb_test "continue" \ |
"Continuing\\..*Breakpoint.*" \ |
"continue to breakpoint once again" |
gdb_test "print a(2)" ".*2 = 2.*" "print the second element of array a" |
|
/module.exp
0,0 → 1,35
# Copyright 2009, 2010 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 |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
set testfile "module" |
set srcfile ${testfile}.f90 |
set binfile ${objdir}/${subdir}/${testfile} |
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { |
untested "Couldn't compile ${srcfile}" |
return -1 |
} |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
gdb_load ${binfile} |
|
if ![runto MAIN__] then { |
perror "couldn't run to breakpoint MAIN__" |
continue |
} |
|
gdb_test "print i" " = 42" |
/Makefile.in
0,0 → 1,34
# Makefile for regression testing the GNU debugger. |
# Copyright 1992, 1993, 1994, 1995, 1996, 1999, 2001, 2003, 2004, 2007, 2008, |
# 2009, 2010 Free Software Foundation, Inc. |
|
# This file is part of GDB. |
|
# GDB is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by |
# the Free Software Foundation; either version 3, or (at your option) |
# any later version. |
|
# GDB is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
|
# You should have received a copy of the GNU General Public License |
# along with this program; if not, write to the Free Software |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
VPATH = @srcdir@ |
srcdir = @srcdir@ |
|
EXECUTABLES = |
|
all info install-info dvi install uninstall installcheck check: |
@echo "Nothing to be done for $@..." |
|
clean mostlyclean: |
-rm -f *~ *.o *.ci |
-rm -f core ${EXECUTABLES} |
|
distclean maintainer-clean realclean: clean |
-rm -f Makefile config.status config.log |
/complex.exp
0,0 → 1,45
# Copyright 2007, 2008, 2009, 2010 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 |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
set testfile "complex" |
set srcfile ${testfile}.f |
set binfile ${objdir}/${subdir}/${testfile} |
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ |
executable {debug f77 quiet}] != "" } { |
untested "Couldn't compile ${srcfile}" |
return -1 |
} |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
gdb_load ${binfile} |
|
if ![runto MAIN__] then { |
perror "Couldn't run to MAIN__" |
continue |
} |
|
set bp_location [gdb_get_line_number "stop"] |
gdb_test "break $bp_location" \ |
"Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \ |
"breakpoint at stop" |
|
gdb_test "continue" \ |
"Continuing\\..*Breakpoint.*" \ |
"continue to breakpoint" |
|
gdb_test "print c" "\\\$$decimal = \\(1000,-50\\)" |
/module.f90
0,0 → 1,22
! Copyright 2009, 2010 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 |
! the Free Software Foundation; either version 3 of the License, or |
! (at your option) any later version. |
! |
! This program is distributed in the hope that it will be useful, |
! but WITHOUT ANY WARRANTY; without even the implied warranty of |
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
! GNU General Public License for more details. |
! |
! You should have received a copy of the GNU General Public License |
! along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
module mod |
integer :: i = 42 |
end module mod |
|
use mod |
print *, i |
end |
/subarray.exp
0,0 → 1,109
# Copyright 2005, 2007, 2008, 2009, 2010 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 |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# This file was written by Wu Zhou. (woodzltc@cn.ibm.com) |
|
# This file is part of the gdb testsuite. It contains tests for evaluating |
# Fortran subarray expression. |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
if { [skip_fortran_tests] } { return -1 } |
|
set testfile "subarray" |
set srcfile ${testfile}.f |
set binfile ${objdir}/${subdir}/${testfile} |
|
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ |
executable {debug f77}] != ""} { |
return -1 |
} |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
gdb_load ${binfile} |
|
if ![runto MAIN__] then { |
perror "couldn't run to breakpoint MAIN__" |
continue |
} |
|
# Try to set breakpoint at the last write statement. |
|
set bp_location [gdb_get_line_number "str(:)"] |
gdb_test "break $bp_location" \ |
"Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \ |
"breakpoint at the last write statement" |
gdb_test "continue" \ |
"Continuing\\..*Breakpoint.*" \ |
"continue to breakpoint" |
|
# Test four different kinds of subarray expression evaluation. |
|
set test "print str(2:4)" |
gdb_test_multiple $test $test { |
-re "\\$\[0-9\]+ = 'bcd'\r\n$gdb_prompt $" { |
pass $test |
} |
-re "\\$\[0-9\]+ = \\(98 'b', 99 'c', 100 'd'\\)\r\n$gdb_prompt $" { |
# Compiler should produce string, not an array of characters. |
setup_xfail "*-*-*" |
fail $test |
} |
} |
|
set test "print str(:3)" |
gdb_test_multiple $test $test { |
-re "\\$\[0-9\]+ = 'abc'\r\n$gdb_prompt $" { |
pass $test |
} |
-re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c'\\)\r\n$gdb_prompt $" { |
# Compiler should produce string, not an array of characters. |
setup_xfail "*-*-*" |
fail $test |
} |
} |
|
set test "print str(5:)" |
gdb_test_multiple $test $test { |
-re "\\$\[0-9\]+ = 'efg'\r\n$gdb_prompt $" { |
pass $test |
} |
-re "\\$\[0-9\]+ = \\(101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { |
# Compiler should produce string, not an array of characters. |
setup_xfail "*-*-*" |
fail $test |
} |
} |
|
set test "print str(:)" |
gdb_test_multiple $test $test { |
-re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" { |
pass $test |
} |
-re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { |
# Compiler should produce string, not an array of characters. |
setup_xfail "*-*-*" |
fail $test |
} |
} |
|
gdb_test "print array(2:4)" "\\$\[0-9\]+ = \\(2, 3, 4\\)" |
gdb_test "print array(:3)" "\\$\[0-9\]+ = \\(1, 2, 3\\)" |
gdb_test "print array(5:)" "\\$\[0-9\]+ = \\(5, 6, 7\\)" |
gdb_test "print array(:)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7\\)" |
/array-element.f
0,0 → 1,32
c Copyright 2005, 2010 Free Software Foundation, Inc. |
|
c This program is free software; you can redistribute it and/or modify |
c it under the terms of the GNU General Public License as published by |
c the Free Software Foundation; either version 3 of the License, or |
c (at your option) any later version. |
c |
c This program is distributed in the hope that it will be useful, |
c but WITHOUT ANY WARRANTY; without even the implied warranty of |
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c GNU General Public License for more details. |
c |
c You should have received a copy of the GNU General Public License |
c along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
c Ihis file is the F77 source file for array-element.exp. It was written |
c by Wu Zhou. (woodzltc@cn.ibm.com) |
|
dimension a(10) |
write(*,*) 'This is a test.' |
call sub(a,10) |
write(*,*) a |
stop |
end |
|
subroutine sub(a,n) |
dimension a(n) |
do 100 i = 1, n |
a(i) = i |
100 continue |
return |
end |
/complex.f
0,0 → 1,24
c Copyright 2007, 2010 Free Software Foundation, Inc. |
|
c This program is free software; you can redistribute it and/or modify |
c it under the terms of the GNU General Public License as published by |
c the Free Software Foundation; either version 3 of the License, or |
c (at your option) any later version. |
c |
c This program is distributed in the hope that it will be useful, |
c but WITHOUT ANY WARRANTY; without even the implied warranty of |
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c GNU General Public License for more details. |
c |
c You should have received a copy of the GNU General Public License |
c along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
real*8 a,b |
complex*16 c |
|
a = 1000 |
b = -50 |
c = cmplx(a,b) |
write(*,*) s |
stop |
end |
/derived-type.exp
0,0 → 1,99
# Copyright 2005, 2007, 2008, 2009, 2010 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 |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# This file was written by Wu Zhou. (woodzltc@cn.ibm.com) |
|
# This file is part of the gdb testsuite. It contains tests for type-printing |
# and value-printing Fortran derived types. |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
if { [skip_fortran_tests] } { return -1 } |
|
set testfile "derived-type" |
set srcfile ${testfile}.f90 |
set binfile ${objdir}/${subdir}/${testfile} |
|
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ |
executable {debug f77}] != ""} { |
return -1 |
} |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
gdb_load ${binfile} |
|
if ![runto MAIN__] then { |
perror "couldn't run to breakpoint MAIN__" |
continue |
} |
|
# Depending on the compiler version being used, the name of the 4-byte integer |
# and real types can be printed differently. For instance, gfortran-4.1 uses |
# "int4" whereas gfortran-4.3 uses "int(kind=4)". |
set int4 "(int4|integer\\(kind=4\\))" |
set real4 "(real4|real\\(kind=4\\))" |
|
gdb_test "ptype p" "type = Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar" |
|
set test "type-printing for derived type" |
gdb_test_multiple "ptype q" $test { |
-re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character\\*7 :: b\r\n *End Type foo\r\n$gdb_prompt $" { |
pass $test |
} |
-re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character :: b\\(7\\)\r\n *End Type foo\r\n$gdb_prompt $" { |
# Compiler should produce string, not an array of characters. |
setup_xfail "*-*-*" |
fail $test |
} |
} |
|
gdb_breakpoint [gdb_get_line_number "print"] |
gdb_continue_to_breakpoint "print" |
|
gdb_test "print p" "\\$\[0-9\]+ = \\( 1, 2\\.375 \\)" |
gdb_test "print p%c" "\\$\[0-9\]+ = 1" |
gdb_test "print p%d" "\\$\[0-9\]+ = 2\\.375" |
gdb_test "print q%a" "\\$\[0-9\]+ = 3\\.125" |
|
set test "print q%b" |
gdb_test_multiple $test $test { |
-re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" { |
pass $test |
} |
-re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { |
# Compiler should produce string, not an array of characters. |
setup_xfail "*-*-*" |
fail $test |
} |
} |
|
gdb_test "print q%x%c" "\\$\[0-9\]+ = 1" |
gdb_test "print q%x%d" "\\$\[0-9\]+ = 2\\.375" |
|
set test "print q" |
gdb_test_multiple $test $test { |
-re "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), 'abcdefg' \\)\r\n$gdb_prompt $" { |
pass $test |
} |
-re "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\) \\)\r\n$gdb_prompt $" { |
# Compiler should produce string, not an array of characters. |
setup_xfail "*-*-*" |
fail $test |
} |
} |
/exprs.exp
0,0 → 1,286
# Copyright (C) 1994, 1997, 2005, 2007, 2008, 2009, 2010 |
# 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 |
# the Free Software Foundation; either version 3 of the License, or |
# (at your option) any later version. |
# |
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# GNU General Public License for more details. |
# |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
# This file was adapted from old Chill tests by Stan Shebs |
# (shebs@cygnus.com). |
|
if $tracelevel then { |
strace $tracelevel |
} |
|
if { [skip_fortran_tests] } { continue } |
|
set prms_id 0 |
set bug_id 0 |
|
# Set the current language to fortran. This counts as a test. If it |
# fails, then we skip the other tests. |
|
proc set_lang_fortran {} { |
global gdb_prompt |
|
if [gdb_test "set language fortran" ""] { |
return 0; |
} |
|
if ![gdb_test "show language" ".* source language is \"fortran\".*"] { |
return 1; |
} else { |
return 0; |
} |
} |
|
proc test_integer_literals_accepted {} { |
global gdb_prompt |
|
# Test various decimal values. |
|
gdb_test "p 123" " = 123" |
gdb_test "p -123" " = -123" |
} |
|
proc test_character_literals_accepted {} { |
global gdb_prompt |
|
# Test various character values. |
|
gdb_test "p 'a'" " = 'a'" |
|
# Test various substring expression. |
gdb_test "p 'abcdefg'(2:4)" " = 'bcd'" |
gdb_test "p 'abcdefg'(:3)" " = 'abc'" |
gdb_test "p 'abcdefg'(5:)" " = 'efg'" |
gdb_test "p 'abcdefg'(:)" " = 'abcdefg'" |
|
} |
|
proc test_integer_literals_rejected {} { |
global gdb_prompt |
|
test_print_reject "p _" |
} |
|
proc test_logical_literals_accepted {} { |
global gdb_prompt |
|
# Test the only possible values for a logical, TRUE and FALSE. |
|
gdb_test "p .TRUE." " = .TRUE." |
gdb_test "p .FALSE." " = .FALSE." |
} |
|
proc test_float_literals_accepted {} { |
global gdb_prompt |
|
# Test various floating point formats |
|
gdb_test "p .44 .LT. .45" " = .TRUE." |
gdb_test "p .44 .GT. .45" " = .FALSE." |
gdb_test "p 0.44 .LT. 0.45" " = .TRUE." |
gdb_test "p 0.44 .GT. 0.45" " = .FALSE." |
gdb_test "p 44. .LT. 45." " = .TRUE." |
gdb_test "p 44. .GT. 45." " = .FALSE." |
gdb_test "p 44.0 .LT. 45.0" " = .TRUE." |
gdb_test "p 44.0 .GT. 45.0" " = .FALSE." |
gdb_test "p 10D20 .LT. 10D21" " = .TRUE." |
gdb_test "p 10D20 .GT. 10D21" " = .FALSE." |
gdb_test "p 10d20 .LT. 10d21" " = .TRUE." |
gdb_test "p 10d20 .GT. 10d21" " = .FALSE." |
gdb_test "p 10E20 .LT. 10E21" " = .TRUE." |
gdb_test "p 10E20 .GT. 10E21" " = .FALSE." |
gdb_test "p 10e20 .LT. 10e21" " = .TRUE." |
gdb_test "p 10e20 .GT. 10e21" " = .FALSE." |
gdb_test "p 10.D20 .LT. 10.D21" " = .TRUE." |
gdb_test "p 10.D20 .GT. 10.D21" " = .FALSE." |
gdb_test "p 10.d20 .LT. 10.d21" " = .TRUE." |
gdb_test "p 10.d20 .GT. 10.d21" " = .FALSE." |
gdb_test "p 10.E20 .LT. 10.E21" " = .TRUE." |
gdb_test "p 10.E20 .GT. 10.E21" " = .FALSE." |
gdb_test "p 10.e20 .LT. 10.e21" " = .TRUE." |
gdb_test "p 10.e20 .GT. 10.e21" " = .FALSE." |
gdb_test "p 10.0D20 .LT. 10.0D21" " = .TRUE." |
gdb_test "p 10.0D20 .GT. 10.0D21" " = .FALSE." |
gdb_test "p 10.0d20 .LT. 10.0d21" " = .TRUE." |
gdb_test "p 10.0d20 .GT. 10.0d21" " = .FALSE." |
gdb_test "p 10.0E20 .LT. 10.0E21" " = .TRUE." |
gdb_test "p 10.0E20 .GT. 10.0E21" " = .FALSE." |
gdb_test "p 10.0e20 .LT. 10.0e21" " = .TRUE." |
gdb_test "p 10.0e20 .GT. 10.0e21" " = .FALSE." |
gdb_test "p 10.0D+20 .LT. 10.0D+21" " = .TRUE." |
gdb_test "p 10.0D+20 .GT. 10.0D+21" " = .FALSE." |
gdb_test "p 10.0d+20 .LT. 10.0d+21" " = .TRUE." |
gdb_test "p 10.0d+20 .GT. 10.0d+21" " = .FALSE." |
gdb_test "p 10.0E+20 .LT. 10.0E+21" " = .TRUE." |
gdb_test "p 10.0E+20 .GT. 10.0E+21" " = .FALSE." |
gdb_test "p 10.0e+20 .LT. 10.0e+21" " = .TRUE." |
gdb_test "p 10.0e+20 .GT. 10.0e+21" " = .FALSE." |
gdb_test "p 10.0D-11 .LT. 10.0D-10" " = .TRUE." |
gdb_test "p 10.0D-11 .GT. 10.0D-10" " = .FALSE." |
gdb_test "p 10.0d-11 .LT. 10.0d-10" " = .TRUE." |
gdb_test "p 10.0d-11 .GT. 10.0d-10" " = .FALSE." |
gdb_test "p 10.0E-11 .LT. 10.0E-10" " = .TRUE." |
gdb_test "p 10.0E-11 .GT. 10.0E-10" " = .FALSE." |
gdb_test "p 10.0e-11 .LT. 10.0e-10" " = .TRUE." |
gdb_test "p 10.0e-11 .GT. 10.0e-10" " = .FALSE." |
} |
|
proc test_convenience_variables {} { |
global gdb_prompt |
|
gdb_test "set \$foo = 101" " = 101\[\r\n\]*" \ |
"Set a new convenience variable" |
|
gdb_test "print \$foo" " = 101" \ |
"Print contents of new convenience variable" |
|
gdb_test "set \$foo = 301" " = 301\[\r\n\]*" \ |
"Set convenience variable to a new value" |
|
gdb_test "print \$foo" " = 301" \ |
"Print new contents of convenience variable" |
|
gdb_test "set \$_ = 11" " = 11\[\r\n\]*" \ |
"Set convenience variable \$_" |
|
gdb_test "print \$_" " = 11" \ |
"Print contents of convenience variable \$_" |
|
gdb_test "print \$foo + 10" " = 311" \ |
"Use convenience variable in arithmetic expression" |
|
gdb_test "print (\$foo = 32) + 4" " = 36" \ |
"Use convenience variable assignment in arithmetic expression" |
|
gdb_test "print \$bar" " = VOID" \ |
"Print contents of uninitialized convenience variable" |
} |
|
proc test_value_history {} { |
global gdb_prompt |
|
gdb_test "print 101" "\\\$1 = 101" \ |
"Set value-history\[1\] using \$1" |
|
gdb_test "print 102" "\\\$2 = 102" \ |
"Set value-history\[2\] using \$2" |
|
gdb_test "print 103" "\\\$3 = 103" \ |
"Set value-history\[3\] using \$3" |
|
gdb_test "print \$\$" "\\\$4 = 102" \ |
"Print value-history\[MAX-1\] using inplicit index \$\$" |
|
gdb_test "print \$\$" "\\\$5 = 103" \ |
"Print value-history\[MAX-1\] again using implicit index \$\$" |
|
gdb_test "print \$" "\\\$6 = 103" \ |
"Print value-history\[MAX\] using implicit index \$" |
|
gdb_test "print \$\$2" "\\\$7 = 102" \ |
"Print value-history\[MAX-2\] using explicit index \$\$2" |
|
gdb_test "print \$0" "\\\$8 = 102" \ |
"Print value-history\[MAX\] using explicit index \$0" |
|
gdb_test "print 108" "\\\$9 = 108" "" |
|
gdb_test "print \$\$0" "\\\$10 = 108" \ |
"Print value-history\[MAX\] using explicit index \$\$0" |
|
gdb_test "print \$1" "\\\$11 = 101" \ |
"Print value-history\[1\] using explicit index \$1" |
|
gdb_test "print \$2" "\\\$12 = 102" \ |
"Print value-history\[2\] using explicit index \$2" |
|
gdb_test "print \$3" "\\\$13 = 103" \ |
"Print value-history\[3\] using explicit index \$3" |
|
gdb_test "print \$-3" "\\\$14 = 100" \ |
"Print (value-history\[MAX\] - 3) using implicit index \$" |
|
gdb_test "print \$1 + 3" "\\\$15 = 104" \ |
"Use value-history element in arithmetic expression" |
} |
|
proc test_arithmetic_expressions {} { |
global gdb_prompt |
|
# Test unary minus with various operands |
|
# gdb_test "p -(TRUE)" " = -1" "unary minus applied to bool" |
# gdb_test "p -('a')" " = xxx" "unary minus applied to char" |
gdb_test "p -(1)" " = -1" "unary minus applied to int" |
gdb_test "p -(1.0)" " = -1" "unary minus applied to real" |
|
# Test addition with various operands |
|
gdb_test "p .TRUE. + 1" " = 2" "bool plus int" |
gdb_test "p 1 + 1" " = 2" "int plus int" |
gdb_test "p 1.0 + 1" " = 2" "real plus int" |
gdb_test "p 1.0 + 2.0" " = 3" "real plus real" |
|
# Test subtraction with various operands |
|
gdb_test "p .TRUE. - 1" " = 0" "bool minus int" |
gdb_test "p 3 - 1" " = 2" "int minus int" |
gdb_test "p 3.0 - 1" " = 2" "real minus int" |
gdb_test "p 5.0 - 2.0" " = 3" "real minus real" |
|
# Test multiplication with various operands |
|
gdb_test "p .TRUE. * 1" " = 1" "bool times int" |
gdb_test "p 2 * 3" " = 6" "int times int" |
gdb_test "p 2.0 * 3" " = 6" "real times int" |
gdb_test "p 2.0 * 3.0" " = 6" "real times real" |
|
# Test division with various operands |
|
gdb_test "p .TRUE. / 1" " = 1" "bool divided by int" |
gdb_test "p 6 / 3" " = 2" "int divided by int" |
gdb_test "p 6.0 / 3" " = 2" "real divided by int" |
gdb_test "p 6.0 / 3.0" " = 2" "real divided by real" |
|
# Test exponentiation with various operands |
|
gdb_test "p 2 ** 3" " = 8" "int powered by int" |
gdb_test "p 2 ** 2 ** 3" " = 256" "combined exponentiation expression" |
gdb_test "p (2 ** 2) ** 3" " = 64" "combined exponentiation expression in specified order" |
gdb_test "p 4 ** 0.5" " = 2" "int powered by real" |
gdb_test "p 4.0 ** 0.5" " = 2" "real powered by real" |
|
} |
|
# Start with a fresh gdb. |
|
gdb_exit |
gdb_start |
gdb_reinitialize_dir $srcdir/$subdir |
|
gdb_test "set print sevenbit-strings" "" |
|
if [set_lang_fortran] then { |
test_value_history |
test_convenience_variables |
test_integer_literals_accepted |
test_integer_literals_rejected |
test_logical_literals_accepted |
test_character_literals_accepted |
test_float_literals_accepted |
test_arithmetic_expressions |
} else { |
warning "$test_name tests suppressed." 0 |
} |
/subarray.f
0,0 → 1,35
c Copyright 2005, 2010 Free Software Foundation, Inc. |
|
c This program is free software; you can redistribute it and/or modify |
c it under the terms of the GNU General Public License as published by |
c the Free Software Foundation; either version 3 of the License, or |
c (at your option) any later version. |
c |
c This program is distributed in the hope that it will be useful, |
c but WITHOUT ANY WARRANTY; without even the implied warranty of |
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c GNU General Public License for more details. |
c |
c You should have received a copy of the GNU General Public License |
c along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
c Ihis file is the Fortran source file for subarray.exp. It was written |
c by Wu Zhou. (woodzltc@cn.ibm.com) |
|
PROGRAM subarray |
|
character *7 str |
integer array(7) |
|
c Initialize character array "str" and integer array "array". |
str = 'abcdefg' |
do i = 1, 7 |
array(i) = i |
end do |
|
write (*, *) str(2:4) |
write (*, *) str(:3) |
write (*, *) str(5:) |
write (*, *) str(:) |
|
END PROGRAM |
/derived-type.f90
0,0 → 1,40
! Copyright 2006, 2010 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 |
! the Free Software Foundation; either version 3 of the License, or |
! (at your option) any later version. |
! |
! This program is distributed in the hope that it will be useful, |
! but WITHOUT ANY WARRANTY; without even the implied warranty of |
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
! GNU General Public License for more details. |
! |
! You should have received a copy of the GNU General Public License |
! along with this program. If not, see <http://www.gnu.org/licenses/>. |
! |
! Ihis file is the Fortran source file for derived-type.exp. It was written |
! by Wu Zhou. (woodzltc@cn.ibm.com) |
|
program main |
|
type bar |
integer :: c |
real :: d |
end type |
type foo |
real :: a |
type(bar) :: x |
character*7 :: b |
end type foo |
type(foo) :: q |
type(bar) :: p |
|
p = bar(1, 2.375) |
q%a = 3.125 |
q%b = "abcdefg" |
q%x%c = 1 |
q%x%d = 2.375 |
print *,p,q |
|
end program main |