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.13.204.213 with SMTP id o204mr6436755ywd.3.1465056810383; Sat, 04 Jun 2016 09:13:30 -0700 (PDT) X-Received: by 10.157.11.135 with SMTP id 7mr117924oth.17.1465056810321; Sat, 04 Jun 2016 09:13:30 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!p34no2559693qgp.1!news-out.google.com!107ni116qgx.1!nntp.google.com!q32no3579203qgq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 4 Jun 2016 09:13:30 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=92.106.1.167; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG NNTP-Posting-Host: 92.106.1.167 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: fyi, GNAT and SPARK GPL 2016 are out From: gautier_niouzes@hotmail.com Injection-Date: Sat, 04 Jun 2016 16:13:30 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3516 X-Received-Body-CRC: 880398925 Xref: news.eternal-september.org comp.lang.ada:30601 Date: 2016-06-04T09:13:30-07:00 List-Id: Nice release - with new optimizations in the run-time library... and a nice= banana skin. In some cases, an application working well with GNAT for year= s may crash with a nasty raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION = - but only in a typical release mode; in a typical debug mode it works as b= efore. In a nutshell, if you are using Ada.Containers.*Maps, and have code like th= e P_KO procedure below, which is legal Ada 2005 & 2012, the executable will= bomb when built with the -gnatp switch. The cure is to use a cursor like in P_OK. It removes an exception part as w= ell. Is there an inclusion of pragma Suppress(Container_Checks) into the standar= d on its way ? Then the remarks such as A.18.4, 69/2 could be updated accor= dingly. _________________________=20 Gautier's Ada programming=20 http://gautiersblog.blogspot.com/search/label/Ada=20 NB: follow the above link for a valid e-mail address=20 -----------8<-----------8<-----------8<-----------8<------- -- GNAT GPL 2016 pragma, suppression included in -gnatp switch pragma Suppress(Container_Checks);=20 with Ada.Strings.Unbounded.Hash; use Ada.Strings.Unbounded; with Ada.Containers.Hashed_Maps; with Ada.Text_IO; use Ada.Text_IO; procedure Test_2016 is package T_Dic is new Ada.Containers.Hashed_Maps (Key_Type =3D> Ada.Strings.Unbounded.Unbounded_String, Element_Type =3D> Positive, Hash =3D> Ada.Strings.Unbounded.Hash, Equivalent_Keys =3D> Ada.Strings.Unbounded."=3D"); =20 dic: T_Dic.Map; n: Positive:=3D 1; =20 procedure P_KO(s: String) is i: Integer; begin i:=3D dic.Element(To_Unbounded_String(s)); Put_Line("Key found, element=3D" & Integer'Image(i)); exception when Constraint_Error =3D> -- A.18.4, 69/2 Put_Line("Key not found"); dic.Insert(To_Unbounded_String(s), n); n:=3D n + 1; end P_KO; =20 procedure P_OK(s: String) is i: Integer; use T_Dic; curs: Cursor; begin curs:=3D dic.Find(To_Unbounded_String(s)); if curs =3D No_Element then Put_Line("Key not found"); dic.Insert(To_Unbounded_String(s), n); n:=3D n + 1; else i:=3D Element(curs); Put_Line("Key found, element=3D" & Integer'Image(i)); end if; end P_OK; begin P_OK("A"); P_OK("A"); P_KO("B"); P_KO("B"); end;