comp.lang.ada
 help / color / mirror / Atom feed
* raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
@ 2017-05-06 12:18 reinert
  2017-05-06 12:58 ` Dmitry A. Kazakov
  2017-05-06 14:08 ` Jeffrey R. Carter
  0 siblings, 2 replies; 10+ messages in thread
From: reinert @ 2017-05-06 12:18 UTC (permalink / raw)


Hi,

I got the following rare error message (when running my Ada program under debian - updated):


"raised PROGRAM_ERROR : cells.ads:43 finalize/adjust raised exception"


Line 43-50 in "cells.ads" is like this:

  type cell_observation_t is record
      id                  : cell_names1.target_t;
      state               : cell_state_t         := live;
      r, dr               : real_vector2d        := (0.0, 0.0);
      axis                : degree_t;
      children1           : cell_names1.cell_names_sets.set;
      pre_cell, next_cell : target_t             := cnil;
   end record;

Is there something obvious I should be aware of?

It seems hard for me to reproduce the error message. Looks almost like random error situation. I did google, and found something about Unbounded_String, but I cannot relate the error situation to this.

reinert


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 12:18 raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception reinert
@ 2017-05-06 12:58 ` Dmitry A. Kazakov
  2017-05-06 15:01   ` reinert
  2017-05-06 14:08 ` Jeffrey R. Carter
  1 sibling, 1 reply; 10+ messages in thread
From: Dmitry A. Kazakov @ 2017-05-06 12:58 UTC (permalink / raw)


On 2017-05-06 14:18, reinert wrote:

> I got the following rare error message (when running my Ada program under debian - updated):
>
> "raised PROGRAM_ERROR : cells.ads:43 finalize/adjust raised exception"
>
>
> Line 43-50 in "cells.ads" is like this:
>
>   type cell_observation_t is record
>       id                  : cell_names1.target_t;
>       state               : cell_state_t         := live;
>       r, dr               : real_vector2d        := (0.0, 0.0);
>       axis                : degree_t;
>       children1           : cell_names1.cell_names_sets.set;
>       pre_cell, next_cell : target_t             := cnil;
>    end record;
>
> Is there something obvious I should be aware of?

Exceptions inside controlled object's finalization. Presumably you have 
a controlled member in cell_observation_t.

Add this to the main program:

    GNAT.Exception_Traces.Trace_On (GNAT.Exception_Traces.Every_Raise);

to see the original issue.

(Frequently it is an unhandled exception that rolls the stack, which in 
turn destroys a controlled object that raises an exception in its 
Finalize, all thoroughly hidden away with a Program_Error presented 
instead...)

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 12:18 raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception reinert
  2017-05-06 12:58 ` Dmitry A. Kazakov
@ 2017-05-06 14:08 ` Jeffrey R. Carter
  2017-05-06 14:57   ` reinert
  2017-05-06 14:59   ` reinert
  1 sibling, 2 replies; 10+ messages in thread
From: Jeffrey R. Carter @ 2017-05-06 14:08 UTC (permalink / raw)


On 05/06/2017 02:18 PM, reinert wrote:
>
> "raised PROGRAM_ERROR : cells.ads:43 finalize/adjust raised exception"

Typically this is due to Finalize for a controlled object propagating an 
exception. Finalize is not supposed to propagate any exceptions, and if it tries 
to, Program_Error is raised instead. This is defined in ARM 76.1. Probably your 
type has a controlled component, since the type itself is not controlled.

-- 
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 14:08 ` Jeffrey R. Carter
@ 2017-05-06 14:57   ` reinert
  2017-05-06 15:46     ` Jeffrey R. Carter
  2017-05-06 14:59   ` reinert
  1 sibling, 1 reply; 10+ messages in thread
From: reinert @ 2017-05-06 14:57 UTC (permalink / raw)


On Saturday, May 6, 2017 at 4:08:09 PM UTC+2, Jeffrey R. Carter wrote:
 Probably your 
> type has a controlled component, since the type itself is not controlled.
> 
> -- 

Can Ada.Containers.Ordered_Sets include a controlled component?

I my code (record) given above

children1           : cell_names1.cell_names_sets.set;

is of type Ada.Containers.Ordered_Sets.
In case this cause the program error, how to solve the problem?

reinert


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 14:08 ` Jeffrey R. Carter
  2017-05-06 14:57   ` reinert
@ 2017-05-06 14:59   ` reinert
  2017-05-06 15:05     ` Dmitry A. Kazakov
  1 sibling, 1 reply; 10+ messages in thread
From: reinert @ 2017-05-06 14:59 UTC (permalink / raw)


On Saturday, May 6, 2017 at 4:08:09 PM UTC+2, Jeffrey R. Carter wrote:

> Probably your type has a controlled component, since the type itself is not controlled.
>

Can Ada.Containers.Ordered_Sets include a controlled component? 

In my code (record) given above 

children1           : cell_names1.cell_names_sets.set; 

is of type Ada.Containers.Ordered_Sets. 
In case this cause the program error, how to solve the problem? 

reinert 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 12:58 ` Dmitry A. Kazakov
@ 2017-05-06 15:01   ` reinert
  0 siblings, 0 replies; 10+ messages in thread
From: reinert @ 2017-05-06 15:01 UTC (permalink / raw)


On Saturday, May 6, 2017 at 2:58:17 PM UTC+2, Dmitry A. Kazakov wrote:

> Add this to the main program:
> 
>     GNAT.Exception_Traces.Trace_On (GNAT.Exception_Traces.Every_Raise);
> 

I'll try. It may take some time to repeat the program error.

reinert


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 14:59   ` reinert
@ 2017-05-06 15:05     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry A. Kazakov @ 2017-05-06 15:05 UTC (permalink / raw)


On 2017-05-06 16:59, reinert wrote:
> On Saturday, May 6, 2017 at 4:08:09 PM UTC+2, Jeffrey R. Carter wrote:
>
>> Probably your type has a controlled component, since the type itself is not controlled.
>
> Can Ada.Containers.Ordered_Sets include a controlled component?
>
> In my code (record) given above
>
> children1           : cell_names1.cell_names_sets.set;
>
> is of type Ada.Containers.Ordered_Sets.
> In case this cause the program error, how to solve the problem?

It is possible but doubtful that Ada.Containers.Ordered_Sets has a bug. 
It is more likely an induced error. Use exceptions tracing to see what 
exactly goes on before Program_Error happens.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 14:57   ` reinert
@ 2017-05-06 15:46     ` Jeffrey R. Carter
  2017-05-07 19:15       ` reinert
  2017-05-07 19:19       ` reinert
  0 siblings, 2 replies; 10+ messages in thread
From: Jeffrey R. Carter @ 2017-05-06 15:46 UTC (permalink / raw)


On 05/06/2017 04:57 PM, reinert wrote:
>
> Can Ada.Containers.Ordered_Sets include a controlled component?

ARM A.18.7 says, "The type Set needs finalization (see 7.6).", which effectively 
means it is controlled. This is true of all the unbounded containers.

It's possible but unlikely that your compiler's implementation of Ordered_Sets 
has an error. Operations on sets should leave the set in a valid state for 
finalization. So I don't see how having a set component could cause this.

-- 
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 15:46     ` Jeffrey R. Carter
@ 2017-05-07 19:15       ` reinert
  2017-05-07 19:19       ` reinert
  1 sibling, 0 replies; 10+ messages in thread
From: reinert @ 2017-05-07 19:15 UTC (permalink / raw)


I removed (replaced) all use of Generic_Keys for Ordered_Sets and now the error:

"raised PROGRAM_ERROR : cells.ads:43 finalize/adjust raised exception"

has not appeared (so far). Finger crossed. Seems like I should be expert before using Generic_Keys :-)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception
  2017-05-06 15:46     ` Jeffrey R. Carter
  2017-05-07 19:15       ` reinert
@ 2017-05-07 19:19       ` reinert
  1 sibling, 0 replies; 10+ messages in thread
From: reinert @ 2017-05-07 19:19 UTC (permalink / raw)


I removed (replaced) all use of Generic_Keys for Ordered_Sets and now the error: 

"raised PROGRAM_ERROR : cells.ads:43 finalize/adjust raised exception" 

has not appeared (so far). Fingers crossed. Seems like I should be expert before using Generic_Keys :-) 


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-05-07 19:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-06 12:18 raised PROGRAM_ERROR : XXXXXX finalize/adjust raised exception reinert
2017-05-06 12:58 ` Dmitry A. Kazakov
2017-05-06 15:01   ` reinert
2017-05-06 14:08 ` Jeffrey R. Carter
2017-05-06 14:57   ` reinert
2017-05-06 15:46     ` Jeffrey R. Carter
2017-05-07 19:15       ` reinert
2017-05-07 19:19       ` reinert
2017-05-06 14:59   ` reinert
2017-05-06 15:05     ` Dmitry A. Kazakov

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