1# Copyright 2007-2020 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 16standard_testfile .f90 17load_lib fortran.exp 18 19if {[skip_fortran_tests]} { return -1 } 20 21if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90 quiet}]} { 22 return -1 23} 24 25if ![fortran_runto_main] then { 26 perror "Couldn't run to main" 27 continue 28} 29 30# Depending on the compiler being used, the type names can be printed differently. 31set complex4 [fortran_complex4] 32set complex8 [fortran_complex8] 33set complex16 [fortran_complex16] 34 35gdb_breakpoint [gdb_get_line_number "stop"] 36gdb_continue_to_breakpoint "continue" 37 38gdb_test "print c" " = \\(1000,-50\\)" 39gdb_test "print c4" " = \\(1000,-50\\)" 40gdb_test "print c8" " = \\(321,-22\\)" 41gdb_test "print dc" " = \\(321,-22\\)" 42 43gdb_test "print c16" " = \\(-874,19\\)" 44 45gdb_test "whatis c" "type = $complex4" 46gdb_test "print \$_creal (c)" " = 1000" 47with_test_prefix "c" { 48 gdb_test "whatis \$" " = real" 49} 50 51gdb_test "whatis c4" "type = $complex4" 52gdb_test "print \$_creal (c4)" " = 1000" 53with_test_prefix "c4" { 54 gdb_test "whatis \$" " = real" 55} 56gdb_test "whatis c8" "type = $complex8" 57gdb_test "print \$_creal (c8)" " = 321" 58with_test_prefix "c8" { 59 gdb_test "whatis \$" " = real\\*8" 60} 61gdb_test "whatis dc" "type = $complex8" 62gdb_test "print \$_creal (dc)" " = 321" 63with_test_prefix "dc" { 64 gdb_test "whatis \$" " = real\\*8" 65} 66 67gdb_test "whatis c16" "type = $complex16" 68gdb_test "print \$_creal (c16)" " = -874" 69with_test_prefix "c16" { 70 gdb_test "whatis \$" " = real\\*16" 71} 72 73