From: Tero Koskinen <tero.koskinen@iki.fi>
Subject: Re: Ada.Strings.Fixed.Count raises Storage_Error
Date: Thu, 12 May 2016 18:22:08 +0300
Date: 2016-05-12T18:22:08+03:00 [thread overview]
Message-ID: <nh272n$l05$1@loke.gir.dk> (raw)
In-Reply-To: <57346ac8$0$4570$426a74cc@news.free.fr>
Hi,
12.5.2016, 14.36, Xavier Petit wrote:
> Hello, I would like to know if it is normal or a known bug.
>
> function Count
> (Source : String;
> Pattern : String;
> Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
>
> When Source'Last = Positive'Last and Pattern'Length = 1, I get
> Storage_Error, it seems this is because the checks are suppressed in
> this GNAT runtime function ? So with checks it would result a
> Constraint_Error ?
...
>
> Here the code :
>
> with Ada.Strings.Fixed, Ada.Integer_Text_IO;
> use Ada.Strings.Fixed, Ada.Integer_Text_IO;
>
> procedure Test_Count is
> S : constant String (Positive'Last - 2 .. Positive'Last) := "Ada";
> begin
> Put (Count (Source => S, Pattern => "AA"));
> Put (Count (Source => S (S'First .. S'Last - 1), Pattern => "A"));
> Put (Count (Source => S, Pattern => "A"));
> end;
>
> Output on gnat-gcc 5.3.1 :
>
> 0 1
>
> raised STORAGE_ERROR : stack overflow or erroneous memory access
When compiled with Janus/Ada the output is following:
C:\Work\xavier-fixed-count\obj> test_cou
0 1 1
C:\Work\xavier-fixed-count\obj>
I would say that Janus/Ada is correct here and you have found a bug from
GNAT.
>
> Thanks by advance
>
Yours,
Tero
next prev parent reply other threads:[~2016-05-12 15:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 11:36 Ada.Strings.Fixed.Count raises Storage_Error Xavier Petit
2016-05-12 15:22 ` Tero Koskinen [this message]
2016-05-12 22:05 ` Georg Bauhaus
2016-06-26 21:18 ` Victor Porton
2016-06-26 23:23 ` rieachus
2016-06-27 0:21 ` Jeffrey R. Carter
2016-06-27 4:00 ` rieachus
2016-06-27 0:51 ` Xavier Petit
2016-06-27 4:48 ` rieachus
2016-06-28 18:25 ` Xavier Petit
2016-06-29 18:49 ` Niklas Holsti
2016-06-29 19:40 ` Jeffrey R. Carter
2016-06-29 19:57 ` Dmitry A. Kazakov
2016-07-01 11:48 ` rieachus
2016-07-01 13:08 ` Dmitry A. Kazakov
2016-06-27 8:29 ` Simon Wright
2016-06-27 8:41 ` Georg Bauhaus
2016-06-29 8:15 ` Niklas Holsti
2016-06-29 9:13 ` J-P. Rosen
2016-06-29 17:43 ` Niklas Holsti
2016-06-29 18:19 ` J-P. Rosen
2016-06-29 20:30 ` Robert A Duff
2016-06-30 5:38 ` Niklas Holsti
2016-07-01 10:40 ` rieachus
2016-07-01 10:55 ` J-P. Rosen
2016-07-01 12:17 ` rieachus
2016-07-01 12:55 ` G.B.
2016-06-27 12:52 ` Victor Porton
2016-05-12 22:56 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox