* Storage_Error: mine's or gnat's fault?
@ 2016-06-03 21:01 Alejandro R. Mosteo
2016-06-03 21:43 ` Alejandro R. Mosteo
0 siblings, 1 reply; 6+ messages in thread
From: Alejandro R. Mosteo @ 2016-06-03 21:01 UTC (permalink / raw)
I'm seeing this (sanitized) stack trace when using the
*Ada.Containers.Holders* package (both 2015/2016 version):
--8<--
raised STORAGE_ERROR : stack overflow or erroneous memory access
Ada.Tags.Displace at s-stoele.adb:97
Rx.Producers.Holders.Definites.Reference at a-coinho.adb:379
Rx.Examples.Strings.Subscribe at rx-observable.adb:33
Rx.Examples.Strings."&" at rx-observable.adb:81
Rx.Examples.Basic at rx-examples-basic.adb:14
Main at b__rx-examples-basic.adb:345
--8<--
Since my code has not a single pointer, "new", unchecked operation or
access I feel the responsibility might not be mine... Also the offending
line is a bit of unfathomable (to me) Address arithmetic. I'd post a
sample but the code is spread among several files right now. I could try
to synthesize a self-contained example if it seems a legit bug in the
sages' opinion.
In the meantime I'm going to try with an indefinite list as container.
Álex.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Storage_Error: mine's or gnat's fault?
2016-06-03 21:01 Storage_Error: mine's or gnat's fault? Alejandro R. Mosteo
@ 2016-06-03 21:43 ` Alejandro R. Mosteo
2016-06-03 22:45 ` Jeffrey R. Carter
2016-06-04 18:50 ` Simon Wright
0 siblings, 2 replies; 6+ messages in thread
From: Alejandro R. Mosteo @ 2016-06-03 21:43 UTC (permalink / raw)
On 03/06/16 23:01, Alejandro R. Mosteo wrote:
> I'm seeing this (sanitized) stack trace when using the
> *Ada.Containers.Holders* package (both 2015/2016 version):
>
> --8<--
> raised STORAGE_ERROR : stack overflow or erroneous memory access
>
> Ada.Tags.Displace at s-stoele.adb:97
> Rx.Producers.Holders.Definites.Reference at a-coinho.adb:379
> Rx.Examples.Strings.Subscribe at rx-observable.adb:33
> Rx.Examples.Strings."&" at rx-observable.adb:81
> Rx.Examples.Basic at rx-examples-basic.adb:14
> Main at b__rx-examples-basic.adb:345
> --8<--
>
> Since my code has not a single pointer, "new", unchecked operation or
> access I feel the responsibility might not be mine... Also the offending
> line is a bit of unfathomable (to me) Address arithmetic. I'd post a
> sample but the code is spread among several files right now. I could try
> to synthesize a self-contained example if it seems a legit bug in the
> sages' opinion.
>
> In the meantime I'm going to try with an indefinite list as container.
Using the Indefinite_Doubly_Linked_List the problem is equally suspect
(this is code from a-cidlli.adb):
function First_Element (Container : List) return Element_Type is
begin
if Checks and then Container.First = null then
raise Constraint_Error with "list is empty";
end if;
return Container.First.Element.all; -- <-- RAISES
end First_Element;
I'll try to produce a small trigger.
>
> Álex.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Storage_Error: mine's or gnat's fault?
2016-06-03 21:43 ` Alejandro R. Mosteo
@ 2016-06-03 22:45 ` Jeffrey R. Carter
2016-06-03 22:48 ` Jeffrey R. Carter
2016-06-04 18:50 ` Simon Wright
1 sibling, 1 reply; 6+ messages in thread
From: Jeffrey R. Carter @ 2016-06-03 22:45 UTC (permalink / raw)
On 06/03/2016 02:43 PM, Alejandro R. Mosteo wrote:
>
> function First_Element (Container : List) return Element_Type is
> begin
> if Checks and then Container.First = null then
> raise Constraint_Error with "list is empty";
> end if;
>
> return Container.First.Element.all; -- <-- RAISES
> end First_Element;
What is Checks? If it is/returns False when the list is empty, you'll try to
dereference null.
--
Jeff Carter
"I wave my private parts at your aunties."
Monty Python & the Holy Grail
13
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Storage_Error: mine's or gnat's fault?
2016-06-03 22:45 ` Jeffrey R. Carter
@ 2016-06-03 22:48 ` Jeffrey R. Carter
0 siblings, 0 replies; 6+ messages in thread
From: Jeffrey R. Carter @ 2016-06-03 22:48 UTC (permalink / raw)
On 06/03/2016 03:45 PM, Jeffrey R. Carter wrote:
> On 06/03/2016 02:43 PM, Alejandro R. Mosteo wrote:
>>
>> function First_Element (Container : List) return Element_Type is
>> begin
>> if Checks and then Container.First = null then
>> raise Constraint_Error with "list is empty";
>> end if;
>>
>> return Container.First.Element.all; -- <-- RAISES
>> end First_Element;
>
> What is Checks? If it is/returns False when the list is empty, you'll try to
> dereference null.
My mistake. That's the code for the container, not your code.
--
Jeff Carter
"I wave my private parts at your aunties."
Monty Python & the Holy Grail
13
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Storage_Error: mine's or gnat's fault?
2016-06-03 21:43 ` Alejandro R. Mosteo
2016-06-03 22:45 ` Jeffrey R. Carter
@ 2016-06-04 18:50 ` Simon Wright
2016-06-05 14:05 ` Alejandro R. Mosteo
1 sibling, 1 reply; 6+ messages in thread
From: Simon Wright @ 2016-06-04 18:50 UTC (permalink / raw)
"Alejandro R. Mosteo" <alejandro@mosteo.com> writes:
> Using the Indefinite_Doubly_Linked_List the problem is equally suspect
> (this is code from a-cidlli.adb):
>
> function First_Element (Container : List) return Element_Type is
> begin
> if Checks and then Container.First = null then
> raise Constraint_Error with "list is empty";
> end if;
>
> return Container.First.Element.all; -- <-- RAISES
> end First_Element;
For info, in Ada.Containers.Helpers.Generic_Implementation,
in a-conhel.ads,
Checks : constant Boolean := Container_Checks'Enabled;
And, using Gautier's example, on OS X, neither FSF GCC 6.1.0 nor GNAT
GPL 2016 show the problem (a-cidlli.adb is the same in both compilers
bar the runtime exception, so they are clearly of a similar vintage).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Storage_Error: mine's or gnat's fault?
2016-06-04 18:50 ` Simon Wright
@ 2016-06-05 14:05 ` Alejandro R. Mosteo
0 siblings, 0 replies; 6+ messages in thread
From: Alejandro R. Mosteo @ 2016-06-05 14:05 UTC (permalink / raw)
On 04/06/16 20:50, Simon Wright wrote:
> "Alejandro R. Mosteo" <alejandro@mosteo.com> writes:
>
>> Using the Indefinite_Doubly_Linked_List the problem is equally suspect
>> (this is code from a-cidlli.adb):
>>
>> function First_Element (Container : List) return Element_Type is
>> begin
>> if Checks and then Container.First = null then
>> raise Constraint_Error with "list is empty";
>> end if;
>>
>> return Container.First.Element.all; -- <-- RAISES
>> end First_Element;
>
> For info, in Ada.Containers.Helpers.Generic_Implementation,
> in a-conhel.ads,
>
> Checks : constant Boolean := Container_Checks'Enabled;
>
> And, using Gautier's example, on OS X, neither FSF GCC 6.1.0 nor GNAT
> GPL 2016 show the problem (a-cidlli.adb is the same in both compilers
> bar the runtime exception, so they are clearly of a similar vintage).
Thanks for the info, although I don't think I'm suppressing any checks,
but I will double-check (ha).
Álex.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-05 14:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-03 21:01 Storage_Error: mine's or gnat's fault? Alejandro R. Mosteo
2016-06-03 21:43 ` Alejandro R. Mosteo
2016-06-03 22:45 ` Jeffrey R. Carter
2016-06-03 22:48 ` Jeffrey R. Carter
2016-06-04 18:50 ` Simon Wright
2016-06-05 14:05 ` Alejandro R. Mosteo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox