comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol+abuse@pvv.org>
To: comp.lang.ada@ada-france.org
Subject: Re: A bug in Gnat, or in my code?
Date: Thu, 11 Mar 2004 08:47:40 +0100
Date: 2004-03-11T08:47:40+01:00	[thread overview]
Message-ID: <mailman.89.1078991277.327.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <WTQ3c.85738$dP1.242094@newsc.telia.net>

Bj�rn Persson <spam-away@nowhere.nil> wrote on 11/03/2004 (08:22) :
> This program, when compiled with Gnat 3.3.2 and run on Fedora Core 1, 
> raises Storage_Error on line 7 (because of a segmentation fault):
> 
> procedure Error is                        --  1
>                                           --  2
>    procedure Proc (NullS : String) is     --  3
>       type SA is access String;           --  4
>       Point : SA := new String (1 .. 0);  --  5
>    begin                                  --  6
>       Point.all := NullS;                 --  7
>    end Proc;                              --  8
>                                           --  9
>    S : String := "s";                     -- 10
> begin                                     -- 11
>    Proc(S(3 .. 1));                       -- 12
> end Error;                                -- 13
> 
> If I change 3 to 2 on line 12 there is no error. As far as I can see, 
> (3..1) should be as legal as (2..1).
> 
> Am I right that this is a bug in Gnat?

I don't get this behaviour in gnat 3.15p so it is probably a gnat 3.3.2
bug. That said what are you trying to do with the code? It looks wierd
to me.

-- 
Preben Randhol -------------- http://www.pvv.org/~randhol/Ada95 --
                 �For me, Ada95 puts back the joy in programming.�



  reply	other threads:[~2004-03-11  7:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-11  3:18 A bug in Gnat, or in my code? Björn Persson
2004-03-11  7:47 ` Preben Randhol [this message]
2004-03-11 12:48   ` Georg Bauhaus
2004-03-11 13:59     ` Björn Persson
2004-03-12 16:21       ` Florian Villoing
2004-03-12 23:01         ` Björn Persson
2004-03-11 14:29   ` Björn Persson
2004-03-11 14:59     ` Preben Randhol
2004-03-11 17:08       ` Björn Persson
2004-03-11 17:14         ` Preben Randhol
2004-03-11 18:15           ` Björn Persson
2004-03-11 15:08     ` Preben Randhol
2004-03-12  2:59 ` Björn Persson
2004-03-12  5:25   ` Per Sandberg
2004-03-12 23:01     ` Björn Persson
2004-03-12 11:11   ` Manuel Collado
2004-03-12 23:01     ` Björn Persson
replies disabled

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