http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60977
Bug ID: 60977 Summary: Float_IO.Put fails on large floats when 'digits exceeds 15 Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: georggcc at googlemail dot com with Ada.Text_IO; use Ada.Text_IO; with System; procedure Float_Segfault is type Flt is digits System.Max_Digits; package Fio is new Float_IO (Flt); begin Fio.Put (Item => Flt'Last, Aft => 1, Exp => 0); end Float_Segfault; Assumption: Put should always print a large floating point number, or raise an exception. The effects seen, however, on both Mac and on GNU/Linux include neither a number output nor an exception such as Layout_Error. Rather, the program hangs, or does other curious things. Playing with some parameters, for example changing the Flt type, type Flt is digits System.Max_Digits - 2; or dividing the parameter passed for Item by powers of 10 changes little. Seemingly this happens in System.Img_Real.Set_Real_Image, according to GDB. On Mac: $ uname -r -s -m Darwin 11.4.2 x86_64 $ gnatmake -gnatVa -gnateF -gnatwa -gnatv float_segfault.adb gcc -c -gnatVa -gnateF -gnatwa -gnatv float_segfault.adb GNAT 4.10.0 20140427 (experimental) [trunk revision 209835] Copyright 1992-2014, Free Software Foundation, Inc. Compiling: float_segfault.adb (source file time stamp: 2014-04-27 11:38:41) 14 lines: No errors gnatbind -x float_segfault.ali gnatlink float_segfault.ali $ ./float_segfault ^C (In this example screen, the program hangs.) On GNU/Linux: $ uname -r -o -m 2.6.32-5-amd64 x86_64 GNU/Linux $ ./float_segfault Segmentation fault Compilers used: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/Users/bauhaus/mine/libexec/gcc/x86_64-apple-darwin11.4.2/4.10.0/lto-wrapper Target: x86_64-apple-darwin11.4.2 Configured with: /Users/bauhaus/src/gcc/configure --prefix=/Users/bauhaus/mine --disable-nls --disable-multilib --disable-libstdcxx-pch CC=gcc --enable-languages=c,ada,c++,go --no-create --no-recursion Thread model: posix gcc version 4.10.0 20140427 (experimental) [trunk revision 209835] (GCC) $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/bauhaus/opt/GNAT2013/bin/../libexec/gcc/x86_64-pc-linux-gnu/4.7.4/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../src/configure --enable-_cxa_atexit --enable-threads=posix --enable-checking=release --enable-languages=ada,c,c++ --with-bugurl=URL:mailto:rep...@adacore.com --disable-nls --without-libiconv-prefix --disable-libmudflap --disable-libstdcxx-pch --disable-libada --disable-multilib --with-mpfr=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/mpfr/install --with-gmp=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/gmp/install --with-mpc=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/mpc/install --with-libelf=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/libelf/install --with-build-time-tools=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/gcc/build/buildtools/bin --prefix=/usr/gnat --build=x86_64-pc-linux-gnu : (reconfigured) ../src/configure --enable-_cxa_atexit --enable-threads=posix --enable-checking=release --enable-languages=ada,c,c++ --with-bugurl=URL:mailto:rep...@adacore.com --disable-nls --without-libiconv-prefix --disable-libmudflap --disable-libstdcxx-pch --disable-libada --disable-multilib --with-mpfr=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/mpfr/install --with-gmp=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/gmp/install --with-mpc=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/mpc/install --with-libelf=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/libelf/install --with-build-time-tools=/draa.a/gnatmail/sandbox/gpl-2013/x86_64-linux/gcc/build/buildtools/bin --prefix=/usr/gnat --build=x86_64-pc-linux-gnu Thread model: posix gcc version 4.7.4 20130416 for GNAT GPL 2013 (20130314) (GCC)