* Re:strange execution error
@ 2003-02-23 15:49 Zheng Long Gen
0 siblings, 0 replies; only message in thread
From: Zheng Long Gen @ 2003-02-23 15:49 UTC (permalink / raw)
To: comp.lang.ada
>After compiling with GNAT I execute it and it gets completely frozen,
>the most curious about it is that 4 processes are created. Gdb tells me
>the error comes from messages.adb line 152:
>
>
> Append(Source => Str,
> New_Item => Interrupt_ID'Pos(Msg.Value.Which));
acturally the problem is caused by the first call to set_string in
messages.adb
Set_String (UP => Str, S => MFR_Arr(Msg.Cons);
this procedure set the contents of str an access value which points to a
library level aliased constant string. The procedure Append, however, will
free the memory of this constant string after allocate new space of memory.
Work around:
procedure To_unbounded_string will be more safer :
str:=to_unbounded_string(MFR_Arr(Msg.Cons).all);
By the way, the second local procedure append (...) which appends a float to
the unbounded string is also terrible:
............
P : String_Access := null;
begin
Put(P.all, New_Item);
I don't think a string_access object pointing to null can hold anything
legally.
Hope this will help
zhenggen
20030223
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-23 15:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-23 15:49 Re:strange execution error Zheng Long Gen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox