comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: GNAT.Regpat problem.
Date: Tue, 22 Mar 2011 12:21:41 -0700 (PDT)
Date: 2011-03-22T12:21:41-07:00	[thread overview]
Message-ID: <41cae3ac-97b6-4b01-ad73-9ff1ec2fdf86@q12g2000prb.googlegroups.com> (raw)
In-Reply-To: alpine.WNT.2.00.1103221429170.5412@WHIRLWIND

On Mar 22, 11:35 am, "Peter C. Chapin" <PCha...@vtc.vsc.edu> wrote:
> I'm trying to use regular expressions in a program via the package
> GNAT.Regpat. Here is a reduced example:
>
> with Ada.Text_IO; use Ada.Text_IO;
> with GNAT.Regpat;
>
> procedure Check is
>     Matcher : GNAT.Regpat.Pattern_Matcher(10);
>
> begin
>     GNAT.Regpat.Compile(Matcher, "^[:space:]*xyzzy$");
>
> exception
>     when Storage_Error =>
>        Put_Line("Insufficient space in Pattern_Matcher");
>
> end Check;
>
> The documentation for package GNAT.Regpat says this about the Compile
> procedure I think I'm using: "This function [sic] raises Storage_Error if
> Matcher is too small to hold the resulting code (i.e. Matcher.Size has too
> small a value)."
>
> In the example above the size is intentionally set too small. My program
> fails with a PROGRAM_ERROR exception (EXCEPTION_ACCESS_VIOLATION). If I make
> the size of the Matcher just 1, the program hangs. If I make the size
> something reasonable, the program runs fine.
>
> So is this an issue with GNAT.Regpat? It seems like it does not honor its
> documentation. Perhaps I'm doing something wrong.

I'm not sure whether I'm working with the latest version.  However,
when I took the sources for this package from GNAT 4.5.2 and compiled
and ran them (with your test) using a different compiler, a slice
assignment in Emit_Class failed due to out-of-range bounds.  If that
range check were turned off, I can imagine that the result would be
havoc.

                                 -- Adam



  parent reply	other threads:[~2011-03-22 19:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 18:35 GNAT.Regpat problem Peter C. Chapin
2011-03-22 19:01 ` Georg Bauhaus
2011-03-22 19:17 ` Florian Weimer
2011-03-22 19:21 ` Adam Beneschan [this message]
2011-03-22 20:31   ` Simon Wright
2011-03-24 10:23     ` Peter C. Chapin
2011-03-24 10:43       ` Dmitry A. Kazakov
2011-03-24 14:04         ` Peter C. Chapin
2011-03-24 14:34           ` Dmitry A. Kazakov
2011-03-24 16:20             ` Georg Bauhaus
2011-03-24 17:37               ` Dmitry A. Kazakov
2011-03-24 21:12             ` Peter C. Chapin
2011-03-25  9:02               ` Dmitry A. Kazakov
2011-03-24 16:41           ` Georg Bauhaus
replies disabled

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