โŒ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Today โ€” 28 November 2023gcc/ada history

ada: False alarms from -gnatw.t with generic functions

By: Bob Duff
16 November 2023 at 21:45
ada: False alarms from -gnatw.t with generic functions

Disable the warnings generated by -gnatw.t on instances.
Otherwise, we get false positives.

gcc/ada/

	* sem_util.adb (Check_Result_And_Post_State): Disable this when
	we're in an instance. Misc cleanup.
  • [DBH] gcc/ada/sem_util.adb
  • 16 November 2023 at 21:45

ada: Fix incorrect quoting in documentation

16 November 2023 at 07:26
ada: Fix incorrect quoting in documentation

gcc/ada/

	* doc/gnat_rm/the_implementation_of_standard_i_o.rst: Fix a couple
	occurrences of incorrect quoting.
	* gnat_rm.texi: Regenerate.
  • [DBH] gcc/ada/doc/gnat_rm/the_implementation_of_standard_i_o.rst
  • [DBH] gcc/ada/gnat_rm.texi
  • 16 November 2023 at 07:26

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: Error compiling reduction expression with overloaded reducer subprogram

14 November 2023 at 20:06
ada: Error compiling reduction expression with overloaded reducer subprogram

In some cases involving a reduction expression with an overloaded reducer
subprogram, the accumulator type is not determined correctly. This can lead
to spurious compile-time errors.

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference): In the case of a
	Reduce attribute reference, fix bugs in initializing Accum_Typ.
	The previous version was incorrect in the case where E1 refers to
	the first of multiple possible overload resolution candidates and
	that candidate does not turn out to be the right one. The previous
	version also had code to compute Accum_Typ via a different method
	if the initial computation turned out to yield a universal numeric
	type. Delete that initial computation and use the second method in
	all cases.
  • [DBH] gcc/ada/exp_attr.adb
  • 14 November 2023 at 20:06

ada: Further cleanup in finalization machinery

9 November 2023 at 14:00
ada: Further cleanup in finalization machinery

When transient scopes are being materialized, they can give rise to a block
created around the construct being wrapped or not, depending on the kind of
construct.  In both cases finalization actions for the transient objects of
the scope are generated the same way, with normal finalization done manually
immediately after the construct and exceptional finalization deferred to the
enclosing scope by means of a hooking mechanism.

Now when the block is generated, it becomes this enclosing scope, so the
normal finalization that comes with it would also be done immediately after
the construct, even without normal finalization generated manually.

Therefore this change gets rid of the manual finalization as well as of the
hooking in the cases where the block is generated, leading to a significant
streamlining of the expanded code in these cases.  This requires fixing a
small inaccuracy of the Within_Case_Or_If_Expression predicate, which must
only be concerned with the dependent expressions, since those are the only
ones to be treated specially by the finalization machinery.

It also contains a small cleanup for the description of the transient scope
management present at the beginning of the exp_ch7.adb file.

gcc/ada/

	* exp_ch7.ads (Expand_Cleanup_Actions): Move declaration to the
	Finalization Management section.
	* exp_ch7.adb (Transient Scope Management): Move description down to
	after that of the general finalization and make a few changes.
	(Insert_Actions_In_Scope_Around): Call Process_Transients_In_Scope
	only if cleanups are being handled.
	(Process_Transients_In_Scope): Remove redundant test on Clean.
	* exp_util.ads (Within_Case_Or_If_Expression): Adjust description.
	* exp_util.adb (Within_Case_Or_If_Expression): Only return true if
	within the dependent expressions of the conditional expressions.
  • [DBH] gcc/ada/exp_ch7.adb
  • [DBH] gcc/ada/exp_ch7.ads
  • [DBH] gcc/ada/exp_util.adb
  • [DBH] gcc/ada/exp_util.ads
  • 9 November 2023 at 14:00

ada: Fix premature finalization for nested return within extended one

8 November 2023 at 22:29
ada: Fix premature finalization for nested return within extended one

The return object is incorrectly finalized when the nested return is taken,
because the special flag attached to the return object is not updated.

gcc/ada/

	* exp_ch6.adb (Build_Flag_For_Function): New function made up of the
	code building the special flag for return object present...
	(Expand_N_Extended_Return_Statement): ...in there.  Replace the code
	with a call to Build_Flag_For_Function.  Add assertion for the flag.
	(Expand_Non_Function_Return): For a nested return, if the return
	object needs finalization actions, update the special flag.
  • [DBH] gcc/ada/exp_ch6.adb
  • 8 November 2023 at 22:29

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: Add new predicate Is_Address_Compatible_Type

7 November 2023 at 12:28
ada: Add new predicate Is_Address_Compatible_Type

When emitting code for architectures with tagged pointers, it is useful
to be able to recognize values representing addresses because they
require special handling. This commits adds the predicate
Is_Address_Compatible_Type, which differs from the node attribute
Is_Descendant_Of_Address by also taking Standard_Address into account.

gcc/ada/

	* einfo-utils.ads, einfo-utils.adb (Is_Address_Compatible_Type):
	New function.
  • [DBH] gcc/ada/einfo-utils.adb
  • [DBH] gcc/ada/einfo-utils.ads
  • 7 November 2023 at 12:28

ada: Fix internal error on declare expression in expression function

6 November 2023 at 22:34
ada: Fix internal error on declare expression in expression function

When the expression function is not a completion, its (return) expression
does not cause freezing so analyzing the declare expression in this context
must not freeze the type of the object.

The change also contains another fix, which makes it so that the compiler
does not evaluate a nonstatic representation attribute of a scalar subtype
in the same context if the subtype is not already frozen.

gcc/ada/

	* sem_attr.adb (Eval_Attribute): Do not proceed in a spec expression
	for nonstatic representation attributes of a scalar subtype when the
	subtype is not frozen.
	* sem_ch3.adb (Analyze_Object_Declaration): Do not freeze the type
	of the object in a spec expression.
  • [DBH] gcc/ada/sem_attr.adb
  • [DBH] gcc/ada/sem_ch3.adb
  • 6 November 2023 at 22:34

ada: Fix predicate failure that occurred in a test case

4 November 2023 at 13:53
ada: Fix predicate failure that occurred in a test case

The CodePeer test case illustrating a problem where a "high"
precondition failure was expected, died in the GNAT FE on
input_reading.adb.  The problem was in Check_SCIL, where
it didn't properly handle a discriminant_specification.

gcc/ada/

	* sem_scil.adb: Handle discriminant specification.
  • [DBH] gcc/ada/sem_scil.adb
  • 4 November 2023 at 13:53

ada: Handle unchecked conversion in bound

3 November 2023 at 22:04
ada: Handle unchecked conversion in bound

Look through both unchecked and normal conversions when seeing if any
part of a bound is uplevel.

gcc/ada/

	* exp_unst.adb (Note_Uplevel_Bound): Treat
	N_Unchecked_Type_Conversion like N_Type_Conversion.
  • [DBH] gcc/ada/exp_unst.adb
  • 3 November 2023 at 22:04

ada: Remove dependency on System.Val_Bool in System.Img_Bool

3 November 2023 at 13:49
ada: Remove dependency on System.Val_Bool in System.Img_Bool

In order to facilitate the certification of System.Img_Bool, remove
its dependency on unit System.Val_Bool. Modify the definition of
ghost function Is_Boolean_Image_Ghost to take the expected boolean
value and move it to System.Val_Spec.

gcc/ada/

	* libgnat/s-imgboo.adb: Remove with_clause now in spec file.
	* libgnat/s-imgboo.ads: Remove dependency on System.Val_Bool.
	(Image_Boolean): Replace call to Value_Boolean by passing value V
	to updated ghost function Is_Boolean_Image_Ghost.
	* libgnat/s-valboo.ads (Is_Boolean_Image_Ghost): Move to other
	unit.
	(Value_Boolean.): Update precondition.
	* libgnat/s-valspe.ads (Is_Boolean_Image_Ghost): Move here. Add
	new parameter for expected boolean value.
  • [DBH] gcc/ada/libgnat/s-imgboo.adb
  • [DBH] gcc/ada/libgnat/s-imgboo.ads
  • [DBH] gcc/ada/libgnat/s-valboo.ads
  • [DBH] gcc/ada/libgnat/s-valspe.ads
  • 3 November 2023 at 13:49
Before yesterdaygcc/ada history

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: Another couple of cleanups in the finalization machinery

2 November 2023 at 14:05
ada: Another couple of cleanups in the finalization machinery

For package specs and bodies that need finalizers, Build_Finalizer is
invoked from the Standard scope so it needs to adjust the scope stack
before creating new objects; this changes it to do so only once.

For other kinds of scopes, it is invoked from Expand_Cleanup_Actions,
which assumes that the correct scope is already on the stack; that's
why Cleanup_Scopes adjusts the scope stack explicitly, but it should
use Pop_Scope instead of End_Scope to do it.

gcc/ada/

	* exp_ch7.adb (Build_Finalizer): For package specs and bodies, push
	and pop the specs onto the scope stack only once.
	* inline.adb (Cleanup_Scopes): Call Pop_Scope instead of End_Scope.
  • [DBH] gcc/ada/exp_ch7.adb
  • [DBH] gcc/ada/inline.adb
  • 2 November 2023 at 14:05

ada: Deep delta aggregates in postconditions

1 November 2023 at 21:39
ada: Deep delta aggregates in postconditions

Fix a bug in handling array-valued deep delta aggregates occurring in
postconditions. The bug could result in a spurious compilation failure.

gcc/ada/

	* sem_aggr.adb (Resolve_Delta_Array_Aggregate): In the case of a
	deep delta choice, the expected type for the expression will
	typically not be the component type of the array type, so a call
	to Analyze_And_Resolve that assumes otherwise would be an error.
	It turns out that such a call, while wrong, is usually harmless
	because the expression has already been marked as analyzed. This
	doesn't work if the aggregate occurs in a postcondition and, in
	any case, we don't want to rely on this. So do not perform the
	call in the deep case.
  • [DBH] gcc/ada/sem_aggr.adb
  • 1 November 2023 at 21:39

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
โŒ
โŒ