
PR gdb/18644 is caused by GDB using the wrong floating point format for gfortran's 16-byte floating point type, including when the 16-byte float is used as the component of a 32-byte complex type. This commit addresses the issue in two places, first in i386-tdep.c, there is already some code to force the use of floatformats_ia64_quad for specific named types, this is extended to include the type names that gfortran uses for its 16-byte floats. Second, the builtin 16-byte float type (in f-lang.c) is changed so it no longer uses gdbarch_long_double_format. On i386 this type is not 16-bytes, but is smaller, this is not what gfortran is expecting. Instead we now use gdbarch_floatformat_for_type and ask for a 16-byte (128 bit) type using the common gfortran type name. This is then spotted in i386-tdep.c (thanks to the first change above) and we again get floatformats_ia64_quad returned. This patch was tested on X86-64/GNU-Linux using '--target_board=unix' and '--target_board=unix/-m32', and resolves all of the known failures associated with PR gdb/18644. I've also added the test case from the original bug report. gdb/ChangeLog: PR gdb/18644: * f-lang.c (build_fortran_types): Use floatformats_ia64_quad for 16-byte floats. * i386-tdep.c (i386_floatformat_for_type): Use floatformats_ia64_quad for the 16-byte floating point component within a fortran 32-byte complex number. gdb/testsuite/ChangeLog: PR gdb/18644 * gdb.fortran/complex.exp: Remove setup_kfail calls. * gdb.fortran/printing-types.exp: Add new test. * gdb.fortran/printing-types.f90: Add 16-byte real variable for testing. * gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Remove setup_kfail call.
57 lines
1.8 KiB
Text
57 lines
1.8 KiB
Text
# Copyright 2007-2019 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/>.
|
|
|
|
standard_testfile .f90
|
|
|
|
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90 quiet}]} {
|
|
return -1
|
|
}
|
|
|
|
if ![runto MAIN__] then {
|
|
perror "Couldn't run to MAIN__"
|
|
continue
|
|
}
|
|
|
|
|
|
gdb_breakpoint [gdb_get_line_number "stop"]
|
|
gdb_continue_to_breakpoint "continue"
|
|
|
|
gdb_test "print c" " = \\(1000,-50\\)"
|
|
gdb_test "print c4" " = \\(1000,-50\\)"
|
|
gdb_test "print c8" " = \\(321,-22\\)"
|
|
gdb_test "print dc" " = \\(321,-22\\)"
|
|
|
|
gdb_test "print c16" " = \\(-874,19\\)"
|
|
|
|
gdb_test "whatis c" "type = complex\\(kind=4\\)"
|
|
gdb_test "print \$_creal (c)" " = 1000"
|
|
gdb_test "whatis \$" " = real"
|
|
|
|
gdb_test "whatis c4" "type = complex\\(kind=4\\)"
|
|
gdb_test "print \$_creal (c4)" " = 1000"
|
|
gdb_test "whatis \$" " = real"
|
|
|
|
gdb_test "whatis c8" "type = complex\\(kind=8\\)"
|
|
gdb_test "print \$_creal (c8)" " = 321"
|
|
gdb_test "whatis \$" " = real\\*8"
|
|
|
|
gdb_test "whatis dc" "type = complex\\(kind=8\\)"
|
|
gdb_test "print \$_creal (dc)" " = 321"
|
|
gdb_test "whatis \$" " = real\\*8"
|
|
|
|
gdb_test "whatis c16" "type = complex\\(kind=16\\)"
|
|
gdb_test "print \$_creal (c16)" " = -874"
|
|
gdb_test "whatis \$" " = real\\*16"
|
|
|