public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
@ 2003-07-06  2:57 ` dhazeghi at yahoo dot com
  2003-07-11 15:15 ` dhazeghi at yahoo dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-07-06  2:57 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|dhazeghi at yahoo dot com   |
  GCC build triplet|                            |i686-mingw32
   GCC host triplet|                            |i686-mingw32
 GCC target triplet|                            |i686-mingw32
           Keywords|                            |wrong-code


------- Additional Comments From dhazeghi at yahoo dot com  2003-07-06 02:57 -------
Steve,

I don't know if you sent me the code for this (don't see it in my mailbox), but could would you 
mind attaching it here? Thanks,

Dara


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
  2003-07-06  2:57 ` [Bug ada/8925] Floating point code gives incorrect results dhazeghi at yahoo dot com
@ 2003-07-11 15:15 ` dhazeghi at yahoo dot com
  2003-07-11 15:37 ` sjs at essex dot ac dot uk
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-07-11 15:15 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From dhazeghi at yahoo dot com  2003-07-11 15:15 -------
Thanks for the attachment. Your testcase won't compile for me though:

[dara@draco objdir]$ gnatmake rgb_conversion_test.adb 
gcc -c rgb_conversion_test.adb
rgb_conversion_test.adb:6:06: file "creake.ads" not found
rgb_conversion_test.adb:9:06: file "creake.ads" not found
gnatmake: "rgb_conversion_test.adb" compilation error

Are there more files needed to compile the testcase? Thanks,

Dara


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
  2003-07-06  2:57 ` [Bug ada/8925] Floating point code gives incorrect results dhazeghi at yahoo dot com
  2003-07-11 15:15 ` dhazeghi at yahoo dot com
@ 2003-07-11 15:37 ` sjs at essex dot ac dot uk
  2003-07-19 17:35 ` pinskia at physics dot uc dot edu
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: sjs at essex dot ac dot uk @ 2003-07-11 15:37 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From sjs at essex dot ac dot uk  2003-07-11 15:37 -------
Subject: Re:  Floating point code gives incorrect results

At 16:15 11/07/2003, you wrote:
>PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
>
>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8925
>
>
>
>------- Additional Comments From dhazeghi at yahoo dot com  2003-07-11 15:15 -------
>Thanks for the attachment. Your testcase won't compile for me though:
>
>[dara@draco objdir]$ gnatmake rgb_conversion_test.adb 
>gcc -c rgb_conversion_test.adb
>rgb_conversion_test.adb:6:06: file "creake.ads" not found
>rgb_conversion_test.adb:9:06: file "creake.ads" not found
>gnatmake: "rgb_conversion_test.adb" compilation error
>
>Are there more files needed to compile the testcase? Thanks,
>
>Dara

Yes, you already have them. The file floating_point_fault.txt contains all
the source code needed to reproduce the problem, but you have to gnatchop
this file to separate out the various specs and bodies. I have submitted
the files in this way because this is the way ACT work with bug reports.
They always want a single file submitted. Apologies if the gcc team works
in a different way, but I had some difficulty uploading the files to your
database.

Steve.





>------- You are receiving this mail because: -------
>You reported the bug, or are watching the reporter.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
                   ` (2 preceding siblings ...)
  2003-07-11 15:37 ` sjs at essex dot ac dot uk
@ 2003-07-19 17:35 ` pinskia at physics dot uc dot edu
  2003-07-19 17:35 ` pinskia at physics dot uc dot edu
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-19 17:35 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-19 17:35 -------
On the mainline (20030719) on powerpc-apple-darwin6.6, I get:
Enter phase:      180.0
Enter saturation: 1.0
Enter intensity:  0.5
Converted value:           0        191        191
Enter phase:      ^C


Also note most of gcc people did not know about gnatchop (we used to recieving 
preprocessed source files).


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
                   ` (3 preceding siblings ...)
  2003-07-19 17:35 ` pinskia at physics dot uc dot edu
@ 2003-07-19 17:35 ` pinskia at physics dot uc dot edu
  2003-07-19 17:36 ` pinskia at physics dot uc dot edu
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-19 17:35 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-19 17:35 -------
Marking as invalid so it will become ...


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
                   ` (4 preceding siblings ...)
  2003-07-19 17:35 ` pinskia at physics dot uc dot edu
@ 2003-07-19 17:36 ` pinskia at physics dot uc dot edu
  2003-08-07 19:20 ` pinskia at physics dot uc dot edu
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-19 17:36 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-19 17:36 -------
unconfirmed.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
                   ` (5 preceding siblings ...)
  2003-07-19 17:36 ` pinskia at physics dot uc dot edu
@ 2003-08-07 19:20 ` pinskia at physics dot uc dot edu
  2003-08-27  9:46 ` dannysmith at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-07 19:20 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-07 19:20 -------
Could someone test on an x86 machine on a more recent GCC but I think this is caused 
by excess procession problem that GCC uses for x86 but I could be wrong.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
                   ` (6 preceding siblings ...)
  2003-08-07 19:20 ` pinskia at physics dot uc dot edu
@ 2003-08-27  9:46 ` dannysmith at gcc dot gnu dot org
  2003-08-27 10:36 ` dannysmith at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: dannysmith at gcc dot gnu dot org @ 2003-08-27  9:46 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From dannysmith at gcc dot gnu dot org  2003-08-27 09:46 -------
With gcc version 3.4 20030825 (experimental) on i686-pc-mingw32

(after doing the gnatchop thing successfully and building 
rgb_conversion_test.exe)

D:\develop\bugs>rgb_conversion_test
Enter phase:      180
Enter saturation: 1
Enter intensity:  0.5
Converted value:           0        191        191


Danny


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
                   ` (7 preceding siblings ...)
  2003-08-27  9:46 ` dannysmith at gcc dot gnu dot org
@ 2003-08-27 10:36 ` dannysmith at gcc dot gnu dot org
  2003-09-14 22:43 ` kalmquist1 at hotmail dot com
  2003-09-14 23:29 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 11+ messages in thread
From: dannysmith at gcc dot gnu dot org @ 2003-08-27 10:36 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From dannysmith at gcc dot gnu dot org  2003-08-27 10:36 -------
And with gcc version 3.3.1 (mingw special 20030804-1) on i686-pc-mingw32
D:\develop\bugs>rgb_conversion_test
Enter phase:      180
Enter saturation: 1
Enter intensity:  0.5
Converted value:           0        191        191

see comments for pr 8924


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
                   ` (8 preceding siblings ...)
  2003-08-27 10:36 ` dannysmith at gcc dot gnu dot org
@ 2003-09-14 22:43 ` kalmquist1 at hotmail dot com
  2003-09-14 23:29 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 11+ messages in thread
From: kalmquist1 at hotmail dot com @ 2003-09-14 22:43 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From kalmquist1 at hotmail dot com  2003-09-14 22:22 -------
The basic problem appears to be a bug in handling of machine code insertions
by GNAT 3.2.

The code sumbitted with this bug report calls Ada.Numerics.Elementary_Func-
tions.Sin, which in turn calls Ada.Numerics.Aux.Sin.  The version of
Ada.Numerics.Aux.Sin used on the x86 platform contains a machine code
insertion.  The assembly language code produced by the compiler appears to
be correct until we get to the following:

#APP
	fsin                 
	xorl    %eax, %eax 
	fnstsw  %ax
#NO_APP
	fstp	%st(0)

The fstp instruction discards the sin value computed by the fsin instruction.
Skipping to the end of the routine, we see:

	fldt	-40(%ebp)
	leave
	ret

This returns the floating point value stored at -40(%ebp), but no value has
been stored at that location by this routine, so the returned value is whatever
garbage happened to be stored in that memory location before the routine was
called.

Similar code written in C is compiled correctly, so the problem appears to
be GNAT specific.

Based on additional comments numbers 12 and 13, it appears that the problem
has been fixed in more recent versions of GNAT, so the status of this bug
should probably be changed to FIXED.  I haven't done that because I haven't
installed the more recent versions and thus cannot confirm the fix.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug ada/8925] Floating point code gives incorrect results
       [not found] <20021213051600.8925.sjs@essex.ac.uk>
                   ` (9 preceding siblings ...)
  2003-09-14 22:43 ` kalmquist1 at hotmail dot com
@ 2003-09-14 23:29 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-14 23:29 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-14 22:41 -------
Closing as this is fixed in 3.3 and the mainline already.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-09-14 22:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20021213051600.8925.sjs@essex.ac.uk>
2003-07-06  2:57 ` [Bug ada/8925] Floating point code gives incorrect results dhazeghi at yahoo dot com
2003-07-11 15:15 ` dhazeghi at yahoo dot com
2003-07-11 15:37 ` sjs at essex dot ac dot uk
2003-07-19 17:35 ` pinskia at physics dot uc dot edu
2003-07-19 17:35 ` pinskia at physics dot uc dot edu
2003-07-19 17:36 ` pinskia at physics dot uc dot edu
2003-08-07 19:20 ` pinskia at physics dot uc dot edu
2003-08-27  9:46 ` dannysmith at gcc dot gnu dot org
2003-08-27 10:36 ` dannysmith at gcc dot gnu dot org
2003-09-14 22:43 ` kalmquist1 at hotmail dot com
2003-09-14 23:29 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).