The test case below shows a bug in the Long_Long_Float'Image function on
FreeBSD 7:

File test_float.adb;
============

with Ada.Text_IO;              use Ada.Text_IO;

procedure Test_Float is
   L  : Long_Long_Float := 1.000;
   LL : Long_Long_Float := 10.000;
begin
   Put_Line (Long_Long_Float'Image (L/LL));
end Test_Float;

Expected execution result:
=================

10:25 ~/dev% ./test_float 
 1.00000000000000000E-01

Actual behavior with GNAT-GCC 4.3.2:
========================

10:26 ~/dev% ./test_float           
 1.00000000000000006E-01

(Note the trailing "6" after the zero's)

GNAT version:
=========

10:20 ~/dev% gnatls -v

GNATLS 4.3.2
Copyright (C) 1997-2007, Free Software Foundation, Inc.

Source Search Path:
   <Current_Directory>
   /opt/packages/gnat-4.3.2/lib/gcc/i686-portbld-freebsd7/4.3.2/adainclude/


Object Search Path:
   <Current_Directory>
   /opt/packages/gnat-4.3.2/lib/gcc/i686-portbld-freebsd7/4.3.2/adalib/


Project Search Path:
   <Current_Directory>
   /opt/packages/gnat-4.3.2/lib/gnat/

GCC version:
========

10:20 ~/dev% gcc -v
Using built-in specs.
Target: i686-portbld-freebsd7
Configured with: ../gcc-4.3.2/configure --prefix=/[snip]/gcc_4.3.2_install
--enable-languages=c,c++,ada --with-gmp=/[snip]/gmp_inst
--with-mpfr=/[snip]/mpfr_inst --disable-nls --host=i686-portbld-freebsd7
--target=i686-portbld-freebsd7 --build=i686-portbld-freebsd7
--enable-checking=release --enable-threads=posix
Thread model: posix
gcc version 4.3.2 (GCC)


-- 
           Summary: Long_Long_Float'Image returns a wrong value in some
                    cases
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bechir dot zalila at gmail dot com
 GCC build triplet: i686-portbld-freebsd7
  GCC host triplet: i686-portbld-freebsd7
GCC target triplet: i686-portbld-freebsd7


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38325

Reply via email to