From: frederic.ormancey@atosorigin.com (Fr?d?ric Ormancey)
Subject: Erroneous results with LOG function when using inline option (-gnatN)
Date: 3 Aug 2004 09:20:46 -0700
Date: 2004-08-03T09:20:46-07:00 [thread overview]
Message-ID: <9c9fb8b4.0408030820.720a57cb@posting.google.com> (raw)
Hello,
When compiling a simple program using Log function, instance from
Ada.Numerics.Generic_Elementary_Functions, I had an erroneous result
when using -gnatN option ( INLINE ).
Using ASM & Source debug with GVD to compare the code generation with
and without -gnatN option, it seems that the INLINE suppress too much
usefull code ...
Source code causing problem :
with Ada, Ada.Numerics, Ada.Numerics.Generic_Elementary_Functions;
with Text_Io; use Text_Io;
procedure Test_Numeric is
package Math is new Ada.Numerics.Generic_Elementary_Functions
(Long_Float);
use Math;
Taille_Table : Integer := 3534;
Rang : Integer := Taille_Table;
Deux : constant Integer := 2;
Rnbval : Long_Float;
R,P,Q,D : Integer := 0;
T : Integer := 0;
begin
Rnbval := Long_Float(Taille_Table);
Put_Line(Long_Float'IMAGE(Rnbval));
Put_Line(Long_Float'IMAGE(Log(Rnbval)));
Put_Line(Long_Float'IMAGE(Log(2.0)));
Put_Line(Long_Float'IMAGE(Log(Rnbval)/Log(2.0)));
T := Integer(Log(Rnbval)/Log(2.0)) -1;
Put_Line(Integer'IMAGE(T));
end Test_Numeric;
correct result is :
3.53400000000000E+03
8.17018565287964E+00
6.93147180559945E-01
1.17870863245516E+01
11
When using -gnatN option I got this erroneous result :
3.53400000000000E+03
0.E+14
3.53400000053248E+14
5.04315471466814E-4932
2147483647
The platform is Linux RedHat 7.2, with GNAT 3.15p.
Same code compiled with Win2000 GNAT 3.15p seems to be good.
Thanks helping me to find if I made a programation error, or if it is
a bug in compiler.
next reply other threads:[~2004-08-03 16:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-03 16:20 Fr?d?ric Ormancey [this message]
2004-08-03 18:40 ` Erroneous results with LOG function when using inline option (-gnatN) Georg Bauhaus
2004-08-04 12:46 ` Gautier
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox