public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/23519] New: Dividing fixed point number by zero returns zero.
@ 2005-08-22 20:23 listor1 dot rombobeorn at comhem dot se
  2005-08-22 20:24 ` [Bug ada/23519] " listor1 dot rombobeorn at comhem dot se
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: listor1 dot rombobeorn at comhem dot se @ 2005-08-22 20:23 UTC (permalink / raw)
  To: gcc-bugs

According to Simon Wright, with GCC 4.0.0 on MacOS X dividing a fixed point
number by zero doesn't raise an exception but returns zero instead. The test
case is the same as for bug 23514, but it fails in a different way so it appears
to be a different bug.

-- 
           Summary: Dividing fixed point number by zero returns zero.
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: listor1 dot rombobeorn at comhem dot se
                CC: gcc-bugs at gcc dot gnu dot org,simon at pushface dot
                    org
  GCC host triplet: powerpc-apple-darwin7.9.0
GCC target triplet: powerpc-apple-darwin7.9.0


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


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

* [Bug ada/23519] Dividing fixed point number by zero returns zero.
  2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
@ 2005-08-22 20:24 ` listor1 dot rombobeorn at comhem dot se
  2005-08-22 20:26 ` listor1 dot rombobeorn at comhem dot se
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: listor1 dot rombobeorn at comhem dot se @ 2005-08-22 20:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From listor1 dot rombobeorn at comhem dot se  2005-08-22 20:21 -------
Created an attachment (id=9556)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9556&action=view)
test case reported to fail


-- 


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


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

* [Bug ada/23519] Dividing fixed point number by zero returns zero.
  2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
  2005-08-22 20:24 ` [Bug ada/23519] " listor1 dot rombobeorn at comhem dot se
@ 2005-08-22 20:26 ` listor1 dot rombobeorn at comhem dot se
  2005-08-22 20:31 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: listor1 dot rombobeorn at comhem dot se @ 2005-08-22 20:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From listor1 dot rombobeorn at comhem dot se  2005-08-22 20:23 -------
Created an attachment (id=9557)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9557&action=view)
shorter test case, not tried but expected to show the same behaviour


-- 


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


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

* [Bug ada/23519] Dividing fixed point number by zero returns zero.
  2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
  2005-08-22 20:24 ` [Bug ada/23519] " listor1 dot rombobeorn at comhem dot se
  2005-08-22 20:26 ` listor1 dot rombobeorn at comhem dot se
@ 2005-08-22 20:31 ` pinskia at gcc dot gnu dot org
  2005-08-22 20:36 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-22 20:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-22 20:24 -------
Does Ada require divide by zero throw an exception or is it just undefined?

-- 


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


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

* [Bug ada/23519] Dividing fixed point number by zero returns zero.
  2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
                   ` (2 preceding siblings ...)
  2005-08-22 20:31 ` pinskia at gcc dot gnu dot org
@ 2005-08-22 20:36 ` pinskia at gcc dot gnu dot org
  2005-08-22 20:44 ` charlet at adacore dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-22 20:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-22 20:27 -------
This is a true front-end bug as on PPC divide by zero (in an instruction) does not raise an exception so 
there needs to be an extra check which should have been added by the front-end.

Confirmed on the mainline as of 20050705.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   GCC host triplet|powerpc-apple-darwin7.9.0   |
 GCC target triplet|powerpc-apple-darwin7.9.0   |powerpc-*-*
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-22 20:27:37
               date|                            |


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


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

* [Bug ada/23519] Dividing fixed point number by zero returns zero.
  2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
                   ` (3 preceding siblings ...)
  2005-08-22 20:36 ` pinskia at gcc dot gnu dot org
@ 2005-08-22 20:44 ` charlet at adacore dot com
  2005-08-22 20:44 ` laurent at guerby dot net
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: charlet at adacore dot com @ 2005-08-22 20:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From charlet at adacore dot com  2005-08-22 20:39 -------
Subject: Re:  Dividing fixed point number by zero returns zero.

> This is a true front-end bug as on PPC divide by zero (in an instruction) does not raise an exception so 
> there needs to be an extra check which should have been added by the front-end

There is no such requirement in Ada that would force the compiler to
map a PPC divide by zero to an Ada exception.

If you want this kind of check, be sure to use -gnato. Is -gnato
used here ? I suspect not, although the compilation command has not been
provided as far as I can see.

Arno


-- 


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


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

* [Bug ada/23519] Dividing fixed point number by zero returns zero.
  2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
                   ` (4 preceding siblings ...)
  2005-08-22 20:44 ` charlet at adacore dot com
@ 2005-08-22 20:44 ` laurent at guerby dot net
  2005-08-23 21:01 ` simon at pushface dot org
  2005-08-31 16:19 ` dje at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: laurent at guerby dot net @ 2005-08-22 20:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From laurent at guerby dot net  2005-08-22 20:42 -------
Could you try to add before "end g;" the following line:
   Ada.Text_IO.Put_Line (Boolean'Image (T'Machine_Overflows));

And report wether it prints True or False? On x86 and x86_64-linux it prints
True but I do get an exception (without -gnato as of 20050822).

>From the Ada RM

A.5.4 Attributes of Fixed Point Types

4     S'Machine_Overflows
              Yields the value True if overflow and divide-by-zero are
              detected and reported by raising Constraint_Error for every
              predefined operation that yields a result of the type T; yields
              the value False otherwise. The value of this attribute is of the
              predefined type Boolean.

I'm not sure what the compiler is supposed to do when Machine_Overflows is False.

Laurent

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


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


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

* [Bug ada/23519] Dividing fixed point number by zero returns zero.
  2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
                   ` (5 preceding siblings ...)
  2005-08-22 20:44 ` laurent at guerby dot net
@ 2005-08-23 21:01 ` simon at pushface dot org
  2005-08-31 16:19 ` dje at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: simon at pushface dot org @ 2005-08-23 21:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From simon at pushface dot org  2005-08-23 20:55 -------
The behaviour with -gnato and without is the same. On the other hand, 'digits 18' fails as shown,'digits 
9' gives the exception ...
and 'Machine_Overflows is True.

-- 


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


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

* [Bug ada/23519] Dividing fixed point number by zero returns zero.
  2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
                   ` (6 preceding siblings ...)
  2005-08-23 21:01 ` simon at pushface dot org
@ 2005-08-31 16:19 ` dje at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-08-31 16:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at gcc dot gnu dot org  2005-08-31 16:18 -------
On PowerPC, one needs to emit arithmetic instructions using the mnemonic with 
the "o" suffix to test for overflow (including divide by zero).  The GCC 
language and/or front-end would need to inform the backend that this is 
required.  Currently GCC cannot represent that overflow test or divide by zero 
test is required, e.g., with a different RTL code.

-- 


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


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

end of thread, other threads:[~2005-08-31 16:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-22 20:23 [Bug ada/23519] New: Dividing fixed point number by zero returns zero listor1 dot rombobeorn at comhem dot se
2005-08-22 20:24 ` [Bug ada/23519] " listor1 dot rombobeorn at comhem dot se
2005-08-22 20:26 ` listor1 dot rombobeorn at comhem dot se
2005-08-22 20:31 ` pinskia at gcc dot gnu dot org
2005-08-22 20:36 ` pinskia at gcc dot gnu dot org
2005-08-22 20:44 ` charlet at adacore dot com
2005-08-22 20:44 ` laurent at guerby dot net
2005-08-23 21:01 ` simon at pushface dot org
2005-08-31 16:19 ` dje 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).