From: Simon Wright <simon@pushface.org>
Subject: Re: Strange crash on custom iterator
Date: Sat, 30 Jun 2018 15:25:36 +0100
Date: 2018-06-30T15:25:36+01:00 [thread overview]
Message-ID: <lytvpks65b.fsf@pushface.org> (raw)
In-Reply-To: 62e38ee4-f72f-4ed8-bef1-952040fb7f8d@googlegroups.com
Lucretia <laguest9000@googlemail.com> writes:
> On Saturday, 30 June 2018 12:32:14 UTC+1, Simon Wright wrote:
>> Lucretia <> writes:
>>
>> > I finally got around to getting back to my iterator and on a first
>> > test implementation, i.e. to just iterate over each element of the
>> > array, the thing crashes in the Element function when accessing the
>> > array through the cursor.
>> >
>> > The source is https://bpaste.net/show/6c5fca4c0ffd and the gdb session
>> > is https://bpaste.net/show/5b0cf9d2be79
>>
>> UCA.Encoding missing?
>
> Balls! https://bpaste.net/show/a0d108820ce6
First, I think Has_Element should probably be
function Has_Element (Position : in Cursor) return Boolean is
begin
return Position.Index in Position.Data'Range;
end Has_Element;
Second, there's something odd about the Address_To_Access_Conversions:
in Iterate, the address of the passed Container (which is on the
stack!!!) appears in I.Data, but I.Data's length is 0.
I got it to work (at first glance) with
type Cursor is
record
Data : Unicode_String_Access := null;
Index : Positive := Positive'Last;
end record;
type Code_Point_Iterator is new Limited_Controlled and Code_Point_Iterators.Forward_Iterator with
record
Data : Unicode_String_Access := null;
end record;
and in Iterate
return I : Code_Point_Iterator :=
(Limited_Controlled with Data => new Unicode_String'(Container)) do
but of course you probably don't want the copy.
next prev parent reply other threads:[~2018-06-30 14:25 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-30 10:48 Strange crash on custom iterator Lucretia
2018-06-30 11:32 ` Simon Wright
2018-06-30 12:02 ` Lucretia
2018-06-30 14:25 ` Simon Wright [this message]
2018-06-30 14:33 ` Lucretia
2018-06-30 19:25 ` Simon Wright
2018-06-30 19:36 ` Luke A. Guest
2018-07-01 18:06 ` Jacob Sparre Andersen
2018-07-01 19:59 ` Simon Wright
2018-07-02 17:43 ` Luke A. Guest
2018-07-02 19:42 ` Simon Wright
2018-07-03 14:08 ` Lucretia
2018-07-03 14:17 ` J-P. Rosen
2018-07-03 15:06 ` Lucretia
2018-07-03 15:45 ` J-P. Rosen
2018-07-03 15:55 ` Lucretia
2018-07-03 17:00 ` J-P. Rosen
2018-07-03 15:57 ` Dmitry A. Kazakov
2018-07-03 16:07 ` Lucretia
2018-07-03 16:36 ` Dmitry A. Kazakov
2018-07-03 16:42 ` Lucretia
2018-07-03 16:45 ` Lucretia
2018-07-03 20:18 ` Dmitry A. Kazakov
2018-07-03 21:04 ` Lucretia
2018-07-04 1:26 ` Dan'l Miller
2018-07-04 1:59 ` Lucretia
2018-07-04 7:37 ` Dmitry A. Kazakov
2018-07-04 12:46 ` Dan'l Miller
2018-07-04 13:37 ` Dennis Lee Bieber
2018-07-04 7:21 ` Dmitry A. Kazakov
2018-07-03 18:54 ` Dan'l Miller
2018-07-03 20:22 ` Dmitry A. Kazakov
2018-07-04 7:33 ` J-P. Rosen
2018-07-04 7:53 ` Dmitry A. Kazakov
2018-07-04 9:55 ` J-P. Rosen
2018-07-04 10:01 ` Dmitry A. Kazakov
2018-07-04 11:30 ` J-P. Rosen
2018-07-04 13:27 ` Dmitry A. Kazakov
2018-07-04 14:37 ` Dan'l Miller
2018-07-04 14:43 ` Dan'l Miller
2018-07-04 14:57 ` J-P. Rosen
2018-07-04 15:41 ` Lucretia
2018-07-04 16:55 ` Dan'l Miller
2018-07-04 18:01 ` Shark8
2018-07-04 18:57 ` Dmitry A. Kazakov
2018-07-04 19:53 ` Shark8
2018-07-04 20:05 ` Lucretia
2018-07-04 22:04 ` Shark8
2018-07-05 0:12 ` Dan'l Miller
2018-07-05 1:46 ` Shark8
2018-07-05 2:07 ` Luke A. Guest
2018-07-05 16:47 ` Shark8
2018-07-05 17:19 ` Dan'l Miller
2018-07-05 19:14 ` Shark8
2018-07-04 20:43 ` Dmitry A. Kazakov
2018-07-04 17:51 ` Jacob Sparre Andersen
2018-07-04 18:06 ` Shark8
2018-07-04 18:59 ` Dan'l Miller
2018-07-04 19:01 ` Dmitry A. Kazakov
2018-07-05 18:08 ` Randy Brukardt
2018-07-05 19:41 ` Dmitry A. Kazakov
2018-07-04 21:00 ` Jacob Sparre Andersen
2018-07-05 18:06 ` Randy Brukardt
2018-07-04 19:02 ` G. B.
2018-07-04 19:16 ` Dmitry A. Kazakov
2018-07-04 20:40 ` G. B.
2018-07-04 20:55 ` Dmitry A. Kazakov
2018-07-04 21:21 ` G.B.
2018-07-05 7:55 ` Dmitry A. Kazakov
2018-07-06 8:28 ` G.B.
2018-07-06 8:57 ` Dmitry A. Kazakov
2018-07-02 8:31 ` Lucretia
2018-06-30 14:34 ` Lucretia
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox