[ Reported to the Debian BTS as report #148529. Please CC 148529@bugs.debian.org on replies. Log of report can be found at http://bugs.debian.org/148529 ] When I try to call sin(x.xx) in my test program, it seems to return different incorrect results every time. Sometimes I get NaN returned (at least thats what gdb says; Float'Image gives "0.E+05"); sometimes it returns 0, other times it generates an exception (raised CONSTRAINT_ERROR : s-imgrea.adb:236). Whats weird is that the results of the first call depend on the total number of calls that appear after the given point in the program (or something like that). Release: 3.1 (Debian) (Debian unstable) Environment: System: Debian GNU/Linux (unstable) Architecture: i686 Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii gcc-3.1 3.1-2 The GNU C compiler. ii g++-3.1 3.1-2 The GNU C++ compiler. ii libstdc++4 3.1-2 The GNU stdc++ library version 3 ii libstdc++4-dev 3.1-2 The GNU stdc++ library version 3 (developmen ii binutils 2.12.90.0.7-1 The GNU assembler, linker and binary utiliti ii libc6 2.2.5-6 GNU C Library: Shared libraries and Timezone host: i386-linux configured with: /mnt/data/gcc-3.1/gcc-3.1-3.1ds2/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=$\(prefix\)/share/man --infodir=$\(prefix\)/share/info --with-gxx-include-dir=$\(prefix\)/include/g++-v3-3.1 --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --enable-clocale=gnu --enable-threads=posix --enable-java-gc=boehm --enable-objc-gc i386-linux How-To-Repeat: The simple source code can be found in the existing bug report, at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=148529 If you have problems accessing this, I can resend it to you.
Fix: Use sparc instead of i386 (well... hardly a fix... but reportedly it does work).
From: Joakim Olsson <joakim.olsson@hiq.se> To: bam@snoopy.apana.org.au, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, 148529@bugs.debian.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: ada/6911: Sin and Cos returns bad result or exception Date: Thu, 14 Nov 2002 11:23:28 +0100 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6911 Hi I have'nt a clue where this mail is going so bare with me (I'm a newbie to gcc ;-) I've noticed the same bug with 3.1 and 3.2 on RedHat PC-Intel. I couldn't find a solution in the database so I'm posting my analyse here. The configure seems to do something wrong. There are several versions of the package "Ada.Numerics.Aux" and the version that is used is the one called 86numaux.ads and it's body. This package implements Sin and Cos and other stuff with assambler-instructions and not uses interface to the C-functions in libm.a. I don't know why but,,, well the assambler doesn't work. In the rpm from Ada for Linux Team the version uses interface to C-functions and that version seems to work. PS If I've done something wrong by posting this mail, pleas don't hesitate to tell me. Is there a simple solution out there ??? please tell me. DS best regards /joakim olsson HiQ Approve AB SWEDEN
From: Brian May <bam@snoopy.apana.org.au> To: Joakim Olsson <joakim.olsson@hiq.se> Cc: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, 148529@bugs.debian.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org Subject: Re: ada/6911: Sin and Cos returns bad result or exception Date: Mon, 18 Nov 2002 14:46:24 +1100 On Thu, Nov 14, 2002 at 11:23:28AM +0100, Joakim Olsson wrote: > I have'nt a clue where this mail is going so bare with me (I'm a newbie to gcc ;-) It come to me, and the Debian BTS (148529@bugs.debian.org). Presumably it also went into the gcc GNATS system. The nobody@gcc.gnu.org address looks kind of funny... > This package implements Sin and Cos and other stuff with assambler-instructions > and not uses interface to the C-functions in libm.a. The assembler code appears to be exactly the same on gnat 3.14p, where it works. In fact, I think the whole file is the same. > I don't know why but,,, well the assambler doesn't work. I suspect that support for any assembler code is badly broken, but my knowledge of assembler code in Ada is somewhat flakey. I tried moving the assembler code to me source code, but it stopped working even with gnat 3.14p, which was perviously working. It wouldn't surprise me if the assembler code is working, but for some reason that parameters aren't getting passed to/from the Ada code. At one stage I did look at this using a debugger and viewing the assembler code, but I couldn't see anything that looked obviously wrong. > In the rpm from Ada for Linux Team the version uses interface to > C-functions and that version seems to work. > > > PSIf I've done something wrong by posting this mail, pleas don't Nothing wrong that I am aware of. > hesitate to tell me. Is there a simple solution out there ??? please > tell me. DS Create interfaces to the C-functions? Use gnat 3.14? Sorry, these are the only two solutions I know of (not tested the first one myself). -- Brian May <bam@snoopy.apana.org.au>
From: Dara Hazeghi <dhazeghi@yahoo.com> To: 148529@bugs.debian.org, gcc-gnats@gcc.gnu.org, bam@snoopy.apana.org.au, nobody@gcc.gnu.org, fw@deneb.enyo.de Cc: Subject: Re: ada/6911: Sin and Cos returns bad result or exception Date: Mon, 12 May 2003 16:31:18 -0700 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- trail&database=gcc&pr=6911 Hello, the final note in the Debian bug trail for this bug noted that this problem was fixed on gcc 3.3 branch. Is this the case? Right now, mainline and 3.3 branch produce this for me: -7.07105E-01 0.00000E+00 -8.74228E-08 1.74846E-07 -7.07105E-01 (the second testcase). Can anyone confirm the state of this bug. Thanks, Dara
State-Changed-From-To: open->closed State-Changed-Why: Reported fixed after Dara asked for feedback
From: Brian May <bam@snoopy.apana.org.au> To: Dara Hazeghi <dhazeghi@yahoo.com> Cc: 148529@bugs.debian.org, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, fw@deneb.enyo.de Subject: Re: ada/6911: Sin and Cos returns bad result or exception Date: Tue, 13 May 2003 14:05:30 +1000 On Mon, May 12, 2003 at 04:31:18PM -0700, Dara Hazeghi wrote: > the final note in the Debian bug trail for this bug noted that this > problem was fixed on gcc 3.3 branch. Is this the case? Right now, > mainline and 3.3 branch produce this for me: > > -7.07105E-01 > 0.00000E+00 > -8.74228E-08 > 1.74846E-07 > -7.07105E-01 > > (the second testcase). Can anyone confirm the state of this bug. Thanks, For: --- cut --- with Ada.Text_IO; use Ada.Text_IO; with Ada.Numerics; use Ada.Numerics; with Ada.Numerics.Generic_Elementary_Functions; with Aux; use Aux; procedure TestBug2 is type F is new Float; subtype Radians is F; package Maths is new Generic_Elementary_Functions(F); use Maths; begin Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(5.49779))); Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(0.0*pi))); Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(1.0*pi))); Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(2.0*pi))); Ada.Text_IO.Put_Line(Double'Image(Aux.Sin(5.49779))); Ada.Text_IO.Put_Line(F'Image(Sin(5.49779))); Ada.Text_IO.Put_Line(F'Image(Sin(0.0*pi))); Ada.Text_IO.Put_Line(F'Image(Sin(1.0*pi))); Ada.Text_IO.Put_Line(F'Image(Sin(2.0*pi))); Ada.Text_IO.Put_Line(F'Image(Sin(5.49779))); end TestBug2; --- cut --- I get: --- cut --- -7.07104761532644598E-01 0.00000000000000000E+00 -5.42101086242752217E-20 1.08420217248550443E-19 -7.07104761532644598E-01 -7.07105E-01 0.00000E+00 -8.74228E-08 1.74846E-07 -7.07105E-01 --- cut --- Which looks much better then before, but I haven't checked the results against a calculator... This is the same code that failed before. -- Brian May <bam@snoopy.apana.org.au>