comp.lang.ada
 help / color / mirror / Atom feed
From: ake.ragnar.dahlgren@gmail.com
Subject: Expected exception is not thrown in Windows XP, should be a compiler bug?
Date: Mon, 27 May 2013 03:10:16 -0700 (PDT)
Date: 2013-05-27T03:10:16-07:00	[thread overview]
Message-ID: <c289150d-1551-421e-8456-eb260d0de63f@googlegroups.com> (raw)

What follows are two code snippets that are nearly identical but completely different behavior during runtime.

Consider the following code:

with Ada.Text_IO;
with Ada.Strings.Fixed;
with GNATCOLL.SQL.Postgres;

procedure Main is
   Host_URL      : aliased constant String := "localhosta";
begin
   declare
      type Host_URL_Type is new String (1 .. 9);

      Target_Host_URL      : Host_URL_Type;
   begin
         Ada.Strings.Fixed.Move (Source  => Host_URL,
                                 Target  => String (Target_Host_URL));
   end;
exception
   when others =>
      Ada.Text_IO.Put_Line("Write some error message");
end Main;

When compiled under Windows XP, Gnatcoll release 1.5w is used and GNAT PRO is version .1.0w-20121028 based upon gcc version 4.7.3 one gets the following output:

C:\temp>main

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

C:\temp>





Now consider the following code:

with Ada.Text_IO;
with Ada.Strings.Fixed;
--with GNATCOLL.SQL.Postgres;

procedure Main is
   Host_URL      : aliased constant String := "localhosta";
begin
   declare
      type Host_URL_Type is new String (1 .. 9);

      Target_Host_URL      : Host_URL_Type;
   begin
         Ada.Strings.Fixed.Move (Source  => Host_URL,
                                 Target  => String (Target_Host_URL));
   end;
exception
   when others =>
      Ada.Text_IO.Put_Line("Write some error message");
end Main;

It has the expected output:

C:\temp>main
Write some error message

C:\temp>



The only difference between the two applications is whether the package GNATCOLL.SQL.Postgres is with:ed or not. It is not even used and therefore should not have any impact on the behavior of the application. I cannot detect this bug on my Mac OS X computer at home with GNAT Libre installed on it. Is there anybody else at comp.lang.ada that can detect this bug?

Best regards,
Åke Ragnar Dahlgren

             reply	other threads:[~2013-05-27 10:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27 10:10 ake.ragnar.dahlgren [this message]
2013-05-27 14:45 ` Expected exception is not thrown in Windows XP, should be a compiler bug? Niklas Holsti
2013-05-28 10:17   ` ake.ragnar.dahlgren
2013-05-28 16:46     ` Niklas Holsti
2013-05-27 14:54 ` Jesper Quorning
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox