From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f1a99299e465c053,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews2.google.com!not-for-mail From: frederic.ormancey@atosorigin.com (Fr?d?ric Ormancey) Newsgroups: comp.lang.ada Subject: Erroneous results with LOG function when using inline option (-gnatN) Date: 3 Aug 2004 09:20:46 -0700 Organization: http://groups.google.com Message-ID: <9c9fb8b4.0408030820.720a57cb@posting.google.com> NNTP-Posting-Host: 195.68.44.146 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1091550047 13027 127.0.0.1 (3 Aug 2004 16:20:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 3 Aug 2004 16:20:47 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:2515 Date: 2004-08-03T09:20:46-07:00 List-Id: 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.