[Bug fortran/47642] New: real(kind=16) - libquadmath - segfault on amd64 FreeBSD
mexas at bristol dot ac.uk
gcc-bugzilla@gcc.gnu.org
Tue Feb 8 09:56:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47642
Summary: real(kind=16) - libquadmath - segfault on amd64
FreeBSD
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mexas@bristol.ac.uk
BUZI> uname -a
FreeBSD zzz 9.0-CURRENT FreeBSD 9.0-CURRENT #4 r217412: Fri Jan 14 22:09:57 GMT
2011 root@zzz:/usr/obj/usr/src/sys/BUZI amd64
BUZI> cat tmp.f90
program z
implicit none
real(kind=16) :: q
q=1.0e48_16
write(*,*)q
write(*,*)nearest(q,1.0)
write(*,*)nearest(q,1.0)-q
end program z
BUZI> gfortran46 -Wl,-rpath=/usr/local/lib/gcc46 tmp.f90
BUZI> ./a.out
1.00000000000000000000000000000000000E+0048
1.00000000000000000000000000000000014E+0048
140737488355328.00000000000000000000
BUZI>
This is fine, however, changing the constant to 1e38 gives segfault:
BUZI> cat tmp.f90
program z
implicit none
real(kind=16) :: q
q=1.0e38_16
write(*,*)q
write(*,*)nearest(q,1.0)
write(*,*)nearest(q,1.0)-q
end program z
BUZI> gfortran46 -Wl,-rpath=/usr/local/lib/gcc46 tmp.f90
BUZI> ./a.out
1.00000000000000000000000000000000000E+0038
Segmentation fault (core dumped)
BUZI>
Same with 1e39:
BUZI> cat tmp.f90
program z
implicit none
real(kind=16) :: q
q=1.0e39_16
write(*,*)q
write(*,*)nearest(q,1.0)
write(*,*)nearest(q,1.0)-q
end program z
BUZI> gfortran46 -Wl,-rpath=/usr/local/lib/gcc46 tmp.f90
BUZI> ./a.out
1.00000000000000000000000000000000000E+0039
Segmentation fault (core dumped)
BUZI>
Then 1e29 works correct again
BUZI> cat tmp.f90
program z
implicit none
real(kind=16) :: q
q=1.0e29_16
write(*,*)q
write(*,*)nearest(q,1.0)
write(*,*)nearest(q,1.0)-q
end program z
BUZI> gfortran46 -Wl,-rpath=/usr/local/lib/gcc46 tmp.f90
BUZI> ./a.out
100000000000000000000000000000.00000
100000000000000000000000000000.00002
1.52587890625000000000000000000000000E-0005
BUZI>
>From debugger:
BUZI> gdb a.out a.out.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols
found)...
Core was generated by `a.out'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/gcc46/libgfortran.so.3...done.
Loaded symbols for /usr/local/lib/gcc46/libgfortran.so.3
Reading symbols from /lib/libm.so.5...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /usr/local/lib/gcc46/libgcc_s.so.1...done.
Loaded symbols for /usr/local/lib/gcc46/libgcc_s.so.1
Reading symbols from /usr/local/lib/gcc46/libquadmath.so.0...done.
Loaded symbols for /usr/local/lib/gcc46/libquadmath.so.0
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0 0x00000008010ba0ae in memset () from /lib/libc.so.7
(gdb) (gdb) bt
#0 0x00000008010ba0ae in memset () from /lib/libc.so.7
#1 0x0000000800d98a27 in quadmath_flt128tostr (s=0x7fffffffd250 '0' <repeats
200 times>...,
size=47, n=37, x=Variable "x" is not available.
) at ../.././../gcc-4.6-20110205/libquadmath/quadmath_io.c:95
#2 0x3030303030303030 in ?? ()
#3 0x3030303030303030 in ?? ()
#4 0x3030303030303030 in ?? ()
#5 0x3030303030303030 in ?? ()
#6 0x3030303030303030 in ?? ()
#7 0x3030303030303030 in ?? ()
*skip lots of identical lines*
#968 0x3030303030303030 in ?? ()
#969 0x3030303030303030 in ?? ()
#970 0x3030303030303030 in ?? ()
#971 0x3030303030303030 in ?? ()
#972 0x3030303030303030 in ?? ()
#973 0x3030303030303030 in ?? ()
---Type <return> to continue, or q <return> to quit---
#974 0x3030303030303030 in ?? ()
Cannot access memory at address 0x7ffffffff000
(gdb)
More information about the Gcc-bugs
mailing list