From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.59.205 with SMTP id m13mr17232860qah.7.1369736239851; Tue, 28 May 2013 03:17:19 -0700 (PDT) X-Received: by 10.49.61.137 with SMTP id p9mr2316888qer.40.1369736239759; Tue, 28 May 2013 03:17:19 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!news.glorb.com!ch1no2576883qab.0!news-out.google.com!y6ni51517qax.0!nntp.google.com!ch1no2576874qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 28 May 2013 03:17:19 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=136.163.203.9; posting-account=l8k8IwoAAADeDydswOzwNzmn10qOk9gt NNTP-Posting-Host: 136.163.203.9 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <738d74eb-dbba-4a4b-8d56-a2ce1b39955e@googlegroups.com> Subject: Re: Expected exception is not thrown in Windows XP, should be a compiler bug? From: ake.ragnar.dahlgren@gmail.com Injection-Date: Tue, 28 May 2013 10:17:19 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:15661 Date: 2013-05-28T03:17:19-07:00 List-Id: Den m=E5ndagen den 27:e maj 2013 kl. 16:45:14 UTC+2 skrev Niklas Holsti: > On 13-05-27 12:10 , ake.ragnar.dahlgren@gmail.com wrote: > What follows a= re two code snippets that are nearly identical > but completely different b= ehavior during runtime. > > Consider the following code: > > with Ada.Text_= IO; > with Ada.Strings.Fixed; > with GNATCOLL.SQL.Postgres; [snip] > When c= ompiled under Windows XP, Gnatcoll release 1.5w is > used and GNAT PRO is v= ersion .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. > > > Now consider the following code: > > with= Ada.Text_IO; > with Ada.Strings.Fixed; > --with GNATCOLL.SQL.Postgres; [sn= ip] > It has the expected output: > > C:\temp>main > Write some error messa= ge > > The only difference between the two applications is whether > the pa= ckage GNATCOLL.SQL.Postgres is with:ed or not. It is not > even used and th= erefore should not have any impact on the > behavior of the application. If= you "with" GNATCOLL.SQL.Postgres, that package (and packages that it depen= ds on) are elaborated at run time, before your main procedure starts execut= ing its statements. I don't know what sort of elaboration code those packag= es contain, but, in general, elaboration code can do anything that ordinary= code can do, including making calls to operating system functions that may= fail in some way, which perhaps causes the error message that you quoted. = The reason for such failures may be something in the operating environment = -- perhaps a missing environment variable, or a faulty value in an environm= ent variable -- and is not *necessarily* a bug in the program or in the com= piler. I would look into GNATCOLL.SQL.Postgres, or into its documentation (= if any) to see if its elaboration code can cause the error, and under what = circumstances. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ . Thank you and Jesper for your thoughts. I should further investigate the possibility of a missing environment varia= ble, but if I add more logging to standard out it seems to me that the prob= lem does not occur during elaboration time but during execution of the Ada.= Strings.Fixed.Move command. Consider: with Ada.Text_IO; with Ada.Strings.Fixed; with GNATCOLL.SQL.Postgres; procedure Main is Host_URL : aliased constant String :=3D "localhosta"; begin declare type Host_URL_Type is new String (1 .. 9); Target_Host_URL : Host_URL_Type; begin Ada.Text_IO.Put_Line ("Will execute Main method"); Ada.Strings.Fixed.Move (Source =3D> Host_URL, Target =3D> String (Target_Host_URL)); Ada.Text_IO.Put_Line("Executed Main method"); end; exception when others =3D> Ada.Text_IO.Put_Line("Write some error message"); end Main; It has the following output: C:\temp>main Will execute Main method This application has requested the Runtime to terminate it in an unusual wa= y. Please contact the application's support team for more information. C:\temp> Maybe the GNATCOLL.SQL.Postgres package creates a new task that executes so= me C-code which makes the whole application crash and it just happens to do= so during the execution of the Ada.Strings.Fixed.Move command by the envir= onment task? Best regards, =C5ke Ragnar Dahlgren