public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work
@ 2005-08-22 10:49 kuan_long at hotmail dot com
  2005-08-22 12:47 ` [Bug ada/23514] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kuan_long at hotmail dot com @ 2005-08-22 10:49 UTC (permalink / raw)
  To: gcc-bugs

the bug should be only in windows OS


my test evnironment is win2k and win xp.
they are not work well.
I have try those compiler:
Gnat 3.15 p / mingw 3.42 / mingw 4.1


--the test code is
With Ada.Text_Io;
Procedure Trading Is
   Type Price Is Delta 0.01 Digits 18;
   Type PriceArray Is Array (Positive Range <>) Of price;
   Procedure Avg (Data : In PriceArray) Is
      Avg, Sum : Price'Base := 0.0;
   Begin
      Ada.Text_Io.Put ("average:"   );
      For Index In Data'Range Loop
         Sum := Sum + Data (Index);
      End Loop;
      Avg := Sum / Data'Length;
      Ada.Text_Io.Put (Price'Image (Avg));
      Ada.Text_Io.New_Line;
   Exception
      When Others =>
         Ada.Text_Io.Put_Line ("error here!");
   End;
Begin
   For Index In Reverse 0 .. 9 Loop
      For Step In 1 .. 3 Loop
         Declare
            Mydata : Pricearray (1 .. Index) :=  (Others => 10.0);
         Begin
            Avg (Mydata);
         End;
      End Loop;
   End Loop;
end Trading;
----end the test code

-- 
           Summary: fixed point error cause Ada exception block does NOT
                    work
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kuan_long at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug ada/23514] fixed point error cause Ada exception block does NOT work
  2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
@ 2005-08-22 12:47 ` pinskia at gcc dot gnu dot org
  2005-08-22 20:02 ` laurent at guerby dot net
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-22 12:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal


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


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

* [Bug ada/23514] fixed point error cause Ada exception block does NOT work
  2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
  2005-08-22 12:47 ` [Bug ada/23514] " pinskia at gcc dot gnu dot org
@ 2005-08-22 20:02 ` laurent at guerby dot net
  2005-08-22 20:50 ` listor1 dot rombobeorn at comhem dot se
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: laurent at guerby dot net @ 2005-08-22 20:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From laurent at guerby dot net  2005-08-22 20:01 -------
With 4.1.0 20050822 (experimental) on x86-linux, I get as output
27 times "average: 10.00" followed by three times "average:error here!"
which seems the correct behaviour since you do for the three last iterations:

Avg := Sum / Data'Length;

with Data'Length = Index = 0

So you get a division by zero exception.

Is the mingw behaviour different, or am I missing something obvious in your code?

Laurent

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug ada/23514] fixed point error cause Ada exception block does NOT work
  2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
  2005-08-22 12:47 ` [Bug ada/23514] " pinskia at gcc dot gnu dot org
  2005-08-22 20:02 ` laurent at guerby dot net
@ 2005-08-22 20:50 ` listor1 dot rombobeorn at comhem dot se
  2005-08-22 20:52 ` laurent at guerby dot net
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: listor1 dot rombobeorn at comhem dot se @ 2005-08-22 20:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From listor1 dot rombobeorn at comhem dot se  2005-08-22 20:39 -------
The behaviour reported by Windows users is that on the first division by zero an
exception is raised and handled just fine, but the second time the program
enters an infinite loop. Gnat 3.15p, Mingw 3.42, Mingw 4.1 and Cygwin GCC
3.4.4-1 all fail.

On MacOS X the same test case fails in a different way. See bug 23519.

On Gnu/Linux it works as it should. (Gnat 3.15p, GCC 3.4.4 20050314, GCC 4.0.1.)

Reference: Usenet message <dds99e$qgn$1@netnews.hinet.net> with follow-ups
(subject "Ada exception block does NOT work?" in comp.lang.ada)

-- 


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


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

* [Bug ada/23514] fixed point error cause Ada exception block does NOT work
  2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
                   ` (2 preceding siblings ...)
  2005-08-22 20:50 ` listor1 dot rombobeorn at comhem dot se
@ 2005-08-22 20:52 ` laurent at guerby dot net
  2005-08-23 11:26 ` charlet at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: laurent at guerby dot net @ 2005-08-22 20:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From laurent at guerby dot net  2005-08-22 20:48 -------
Ok it's always better to put the context in bugzilla, I don't read comp.lang.ada
regularly anymore these days :).

I haven't seen reports of mingw Ada 4.1 testing on gcc-testresults@gcc.gnu.org,
could someone post one or post here an URL if I missed one? That will at least
tell us wether the Ada compiler is completely broken or not on mingw.

Laurent

-- 


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


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

* [Bug ada/23514] fixed point error cause Ada exception block does NOT work
  2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
                   ` (3 preceding siblings ...)
  2005-08-22 20:52 ` laurent at guerby dot net
@ 2005-08-23 11:26 ` charlet at gcc dot gnu dot org
  2005-08-23 14:44 ` kuan_long at hotmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: charlet at gcc dot gnu dot org @ 2005-08-23 11:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From charlet at gcc dot gnu dot org  2005-08-23 11:25 -------
You need to use -gnato if you want an exception here.
This test case in any case is handled "as expected" in GCC 4.1 as far as I can
see, unless the mingw build is too old or using non standard sources, but you
didn't specify source dates.

Arno

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |WORKSFORME
   Target Milestone|---                         |4.1.1


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


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

* [Bug ada/23514] fixed point error cause Ada exception block does NOT work
  2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
                   ` (4 preceding siblings ...)
  2005-08-23 11:26 ` charlet at gcc dot gnu dot org
@ 2005-08-23 14:44 ` kuan_long at hotmail dot com
  2005-08-23 15:41 ` pinskia at gcc dot gnu dot org
  2005-08-23 18:56 ` charlet at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: kuan_long at hotmail dot com @ 2005-08-23 14:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kuan_long at hotmail dot com  2005-08-23 14:43 -------
-gnato still fail in Mingw 4.1 ,the OS is windows XP


gcc -v
Reading specs from C:/mingw/bin/../lib/gcc/mingw32/3.4.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --
host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --
enable
-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --
e
nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-
ja
va-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-
synchroniz
ation --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|WORKSFORME                  |


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


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

* [Bug ada/23514] fixed point error cause Ada exception block does NOT work
  2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
                   ` (5 preceding siblings ...)
  2005-08-23 14:44 ` kuan_long at hotmail dot com
@ 2005-08-23 15:41 ` pinskia at gcc dot gnu dot org
  2005-08-23 18:56 ` charlet at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-23 15:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-23 15:12 -------
This is a target bug.

http://groups-beta.google.com/group/comp.lang.ada/browse_thread/thread/ee1a8b8db84c88f/
2195130b88e4dc9d?
lnk=st&q=Ada+exception+block+does+NOT+work%3F&rnum=1#2195130b88e4dc9d

Most likely use of setjump/longjump does not work with signals and/or windows signals are handled 
funny.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |mingw32
   Target Milestone|4.1.1                       |---


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


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

* [Bug ada/23514] fixed point error cause Ada exception block does NOT work
  2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
                   ` (6 preceding siblings ...)
  2005-08-23 15:41 ` pinskia at gcc dot gnu dot org
@ 2005-08-23 18:56 ` charlet at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: charlet at gcc dot gnu dot org @ 2005-08-23 18:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From charlet at gcc dot gnu dot org  2005-08-23 18:42 -------
You need a recent GCC 4.1 for this to "work" as expected, so
gcc 3.4 is indeed not expected to work in this case.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


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


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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-22 10:49 [Bug ada/23514] New: fixed point error cause Ada exception block does NOT work kuan_long at hotmail dot com
2005-08-22 12:47 ` [Bug ada/23514] " pinskia at gcc dot gnu dot org
2005-08-22 20:02 ` laurent at guerby dot net
2005-08-22 20:50 ` listor1 dot rombobeorn at comhem dot se
2005-08-22 20:52 ` laurent at guerby dot net
2005-08-23 11:26 ` charlet at gcc dot gnu dot org
2005-08-23 14:44 ` kuan_long at hotmail dot com
2005-08-23 15:41 ` pinskia at gcc dot gnu dot org
2005-08-23 18:56 ` charlet 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).