1 # This test code is part of GDB, the GNU debugger.
3 # Copyright 2010-2022 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Auxiliary function to set the language to fortran.
19 # The result is 1 (true) for success, 0 (false) for failure.
21 proc set_lang_fortran {} {
22 if [gdb_test_no_output "set language fortran"] {
25 if [gdb_test "show language" ".* source language is \"fortran\"." \
26 "set language to \"fortran\""] {
32 proc fortran_int4 {} {
33 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
35 } elseif {[test_compiler_info {gfortran-*} f90]} {
36 return "integer\\(kind=4\\)"
37 } elseif {[test_compiler_info {flang-*} f90]} {
39 } elseif {[test_compiler_info {ifort-*} f90]} {
40 return "INTEGER\\(4\\)"
41 } elseif {[test_compiler_info {ifx-*} f90]} {
48 proc fortran_int8 {} {
49 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
51 } elseif {[test_compiler_info {gfortran-*} f90]} {
52 return "integer\\(kind=8\\)"
53 } elseif {[test_compiler_info {flang-*} f90]} {
55 } elseif {[test_compiler_info {ifort-*} f90]} {
56 return "INTEGER\\(8\\)"
57 } elseif {[test_compiler_info {ifx-*} f90]} {
64 proc fortran_real4 {} {
65 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
67 } elseif {[test_compiler_info {gfortran-*} f90]} {
68 return "real\\(kind=4\\)"
69 } elseif {[test_compiler_info {flang-*} f90]} {
71 } elseif {[test_compiler_info {ifort-*} f90]} {
73 } elseif {[test_compiler_info {ifx-*} f90]} {
80 proc fortran_real8 {} {
81 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
83 } elseif {[test_compiler_info {gfortran-*} f90]} {
84 return "real\\(kind=8\\)"
85 } elseif {[test_compiler_info {flang-*} f90]} {
86 return "double precision"
87 } elseif {[test_compiler_info {ifort-*} f90]} {
89 } elseif {[test_compiler_info {ifx-*} f90]} {
96 proc fortran_complex4 {} {
97 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
99 } elseif {[test_compiler_info {gfortran-*} f90]} {
100 return "complex\\(kind=4\\)"
101 } elseif {[test_compiler_info {flang-*} f90]} {
103 } elseif {[test_compiler_info {ifort-*} f90]} {
104 return "COMPLEX\\(4\\)"
105 } elseif {[test_compiler_info {ifx-*} f90]} {
112 proc fortran_complex8 {} {
113 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
115 } elseif {[test_compiler_info {gfortran-*} f90]} {
116 return "complex\\(kind=8\\)"
117 } elseif {[test_compiler_info {flang-*} f90]} {
118 return "double complex"
119 } elseif {[test_compiler_info {ifort-*} f90]} {
120 return "COMPLEX\\(8\\)"
121 } elseif {[test_compiler_info {ifx-*} f90]} {
122 return "COMPLEX\\*16"
128 proc fortran_complex16 {} {
129 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
131 } elseif {[test_compiler_info {gfortran-*} f90]} {
132 return "complex\\(kind=16\\)"
133 } elseif {[test_compiler_info {flang-*} f90]} {
134 return "quad complex"
135 } elseif {[test_compiler_info {ifort-*} f90]} {
136 return "COMPLEX\\(16\\)"
137 } elseif {[test_compiler_info {ifx-*} f90]} {
138 return "COMPLEX\\*32"
144 proc fortran_logical4 {} {
145 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
147 } elseif {[test_compiler_info {gfortran-*} f90]} {
148 return "logical\\(kind=4\\)"
149 } elseif {[test_compiler_info {flang-*} f90]} {
151 } elseif {[test_compiler_info {ifort-*} f90]} {
152 return "LOGICAL\\(4\\)"
153 } elseif {[test_compiler_info {ifx-*} f90]} {
160 proc fortran_character1 {} {
161 if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
163 } elseif {[test_compiler_info {gfortran-*} f90]} {
164 return "character\\(kind=1\\)"
165 } elseif {[test_compiler_info {flang-*} f90]} {
167 } elseif {[test_compiler_info {ifort-*} f90]} {
168 return "CHARACTER\\(1\\)"
169 } elseif {[test_compiler_info {ifx-*} f90]} {
170 return "CHARACTER\\*1"
176 # Return name of the main procedure based on the compiler version.
178 proc fortran_main {} {
179 if {[test_compiler_info {gfortran-*} f90]
180 || [test_compiler_info {ifort-*} f90]
181 || [test_compiler_info {ifx-*} f90]
182 || [test_compiler_info {flang-llvm-*} f90]} {
184 } elseif {[test_compiler_info {flang-classic-*} f90]} {
191 # Fortran version of runto_main.
193 proc fortran_runto_main { } {
194 return [runto [fortran_main]]