โŒ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Before yesterdaygcc/ada history

ada: Missing error on positional container aggregates for types with Add_Named

2 December 2023 at 00:11
ada: Missing error on positional container aggregates for types with Add_Named

The compiler fails to reject a container aggregate written using positional
notation when the container type specifies an Add_Named operation in its
Aggregate aspect. Container aggregates for such types must be written using
named associations. The compiler ignores the positional associations and
produces an empty aggregate object. An error check is added to catch such
illegal container aggregates.

gcc/ada/

	* sem_aggr.adb (Resolve_Container_Aggregate): In the Add_Named
	case, issue an error if the container aggregate is written as a
	positional aggregate, since such an aggregate must have named
	associations.
  • [DBH] gcc/ada/sem_aggr.adb
  • 2 December 2023 at 00:11

ada: Compiler hangs on container aggregate with function call as key expression

30 November 2023 at 19:28
ada: Compiler hangs on container aggregate with function call as key expression

The compiler hangs (or may crash, if assertions are enabled) when compiling
an iterated association of a container aggregate that has a key expression
given by a function call. The resolution of the call leads to a blowup in
Build_Call_Marker, because the temporary copy of the expression that's
analyzed has an Empty parent, causing insertion of the call marker to fail.
The fix for this is to preanalyze, rather than analyze, the copy of the key
expression (Build_Call_Marker will return without creating a call marker in
the case of preanalysis).

gcc/ada/

	* sem_aggr.adb (Resolve_Iterated_Association): Call
	Preanalyze_And_Resolve instead of Analyze_And_Resolve on a key
	expression of an iterated association.
  • [DBH] gcc/ada/sem_aggr.adb
  • 30 November 2023 at 19:28

ada: Errors on instance of Multiway_Trees with discriminated type

15 November 2023 at 23:57
ada: Errors on instance of Multiway_Trees with discriminated type

The compiler may report various type conflicts on an instantiation
of the generic package Ada.Containers.Multiway_Trees with an actual
for Element_Type that is a nonprivate actual type with discriminants
that has a discriminant-dependent component of a private type (such
as a Bounded_Vector type). The type errors occur on an aggregate
of the implementation type Tree_Node_Type within the body of
Multiway_Trees, where the aggregate has a box-defaulted association
for the Element component. (Such type errors could of course arise
in other cases of generic instantiations that follow a similar type
model.)

In the case where the discriminant-dependent component type has a
default-initialization procedure (init proc), the compiler was handling
box associations for such components by expanding the topmost box
association into subaggregates that themselves have box associations,
and didn't properly account for discriminant-dependent subcomponents of
private types. This could be fixed internally in Propagate_Discriminants,
but it seems that the entire machinery for dealing with such subcomponent
associations is unnecessary, and the topmost component association can
be handled directly as a default-initialized box association.

gcc/ada/

	* sem_aggr.adb (Add_Discriminant_Values): Remove this procedure.
	(Propagate_Discriminants): Remove this procedure.
	(Resolve_Record_Aggregate): Remove code (the Capture_Discriminants
	block statement) related to propagating discriminants and
	generating initializations for subcomponents of a
	discriminant-dependent box-defaulted subcomponent of a nonprivate
	record type with discriminants, and handle all top-level
	components that have a non-null base init proc directly, by
	calling Add_Association with "Is_Box_Present => True". Also,
	combine that elsif clause with the immediately preceding elsif
	clause, since they now both contain the same statement (calls to
	Add_Association with the same actuals).
  • [DBH] gcc/ada/sem_aggr.adb
  • 15 November 2023 at 23:57

ada: Type error on container aggregate with loop_parameter_specification

7 November 2023 at 22:16
ada: Type error on container aggregate with loop_parameter_specification

The compiler incorrectly reported a type error on a container aggregate
for a Vector type with a loop_parameter_specification specifying a
nonstatic upper bound, complaining that it expected the Vector index
type, but instead found type Count_Type. The expansion of the aggregate
was incorrectly passing a size temporary of type Count_Type to the
function associated with the New_Indexed part of the container type's
Aggregate aspect (New_Vector in the case of Vectors), which has two
formals of the container index type. The fix is to convert the size
temporary to the expected index type.

gcc/ada/

	* exp_aggr.adb (Expand_Container_Aggregate): Apply a conversion to the
	size temp object passed as the second actual parameter on the call to
	the New_Indexed_Subp function, to convert it to the index type of the
	container type (taken from the first formal parameter of the function).
  • [DBH] gcc/ada/exp_aggr.adb
  • 7 November 2023 at 22:16

ada: Compiler crash on container aggregate with loop_parameter_specifications

2 November 2023 at 23:36
ada: Compiler crash on container aggregate with loop_parameter_specifications

The compiler crashes on a container aggregate with more than one
iterated_element_association given by a loop_parameter_specification.
In such a case, the tree contains N_Iterated_Component_Association
nodes rather than N_Iterated_Element_Association nodes, and the code
for handling those needs to obtain the bounds from the Discrete_Choices
field of each N_Iterated_Component_Association rather than assuming
that the association has a normal list of choices.

gcc/ada/

	* sem_aggr.adb (Resolve_Container_Aggregate): In the case where Comp
	is an N_Iterated_Component_Association, pick up Discrete_Choices rather
	than Choices.
  • [DBH] gcc/ada/sem_aggr.adb
  • 2 November 2023 at 23:36

ada: Compiler error reporting illegal prefix on legal loop iterator with "in"

31 October 2023 at 19:50
ada: Compiler error reporting illegal prefix on legal loop iterator with "in"

During semantic analysis, the compiler fails to determine the cursor type
in the case of a generalized iterator loop with "in", in the case where the
iterator type has a parent type that is a controlled type (for example) and
its ancestor iterator interface type is given after as a progenitor. It also
improperly determines the ancestor interface type during expansion (within
Expand_Iterator_Loop_Over_Container), for both "in" and "of" iterator forms.
The FE was assuming that the iterator interface is simply the parent type
of the iterator type, but that type can occur later in the interface list,
or be inherited. A new function is added that properly locates a type's
iterator interface ancestor, if any, and is called for analysis and expansion.

gcc/ada/

	* exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Retrieve the
	iteration type's iteration interface progenitor via
	Iterator_Interface_Ancestor, in the case of both "in" and "of"
	iterators. Narrow the scope of Pack, so it's declared and
	initialized only within the code related to "of" iterators, and
	change its name to Cont_Type_Pack. Adjust comments.
	* sem_ch5.adb (Get_Cursor_Type): In the case of a derived type,
	retrieve the iteration type's iterator interface progenitor (if it
	exists) via Iterator_Interface_Ancestor rather than assuming that
	the parent type is the interface progenitor.
	* sem_util.ads (Iterator_Interface_Ancestor): New function.
	* sem_util.adb (Iterator_Interface_Ancestor): New function
	returning a type's associated iterator interface type, if any, by
	collecting and traversing the type's interfaces.
  • [DBH] gcc/ada/exp_ch5.adb
  • [DBH] gcc/ada/sem_ch5.adb
  • [DBH] gcc/ada/sem_util.adb
  • [DBH] gcc/ada/sem_util.ads
  • 31 October 2023 at 19:50
โŒ
โŒ