public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mexas at bristol dot ac.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/47642] New: real(kind=16) - libquadmath - segfault on amd64 FreeBSD
Date: Tue, 08 Feb 2011 09:56:00 -0000	[thread overview]
Message-ID: <bug-47642-4@http.gcc.gnu.org/bugzilla/> (raw)

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)


             reply	other threads:[~2011-02-08  9:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08  9:56 mexas at bristol dot ac.uk [this message]
2011-02-08 10:44 ` [Bug fortran/47642] " dominiq at lps dot ens.fr
2011-02-08 12:51 ` jvdelisle at gcc dot gnu.org
2011-02-08 12:54 ` jakub at gcc dot gnu.org
2011-02-08 13:37 ` jvdelisle at gcc dot gnu.org
2011-02-08 14:06 ` jakub at gcc dot gnu.org
2011-02-08 18:28 ` burnus at gcc dot gnu.org
2011-02-08 20:25 ` jvdelisle at gcc dot gnu.org
2011-02-09  0:54 ` mexas at bristol dot ac.uk
2011-02-09  9:03 ` jakub at gcc dot gnu.org
2011-02-12 12:03 ` jakub at gcc dot gnu.org
2011-02-12 12:07 ` jakub at gcc dot gnu.org
2011-02-12 12:08 ` jakub at gcc dot gnu.org
2011-02-12 12:10 ` jakub at gcc dot gnu.org
2011-02-12 12:49 ` jakub at gcc dot gnu.org
2011-02-12 14:57 ` jakub at gcc dot gnu.org
2011-02-14 11:52 ` dominiq at lps dot ens.fr
2011-02-14 11:57 ` jakub at gcc dot gnu.org
2011-02-14 12:56 ` dominiq at lps dot ens.fr
2011-02-14 14:34 ` jakub at gcc dot gnu.org
2011-02-14 15:35 ` dominiq at lps dot ens.fr
2011-02-14 15:45 ` jakub at gcc dot gnu.org
2011-02-17 13:42 ` jakub at gcc dot gnu.org
2011-02-17 14:25 ` jakub at gcc dot gnu.org
2014-04-16 15:46 ` mexas at bristol dot ac.uk
2014-04-17  6:53 ` ubizjak at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-47642-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).