โŒ About FreshRSS

Normal view

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

ada: Spurious warning about negative modular literal

10 August 2023 at 22:39
ada: Spurious warning about negative modular literal

If -gnatw.m is enabled, the compiler generates a warning if a unary
minus operator of a modular type is applied to an integer literal.
This warning was being incorrectly generated in some cases where no integer
literal is present in the source code.

gcc/ada/

	* sem_res.adb (Resolve_Unary_Op): In deciding whether to emit a
	warning about a modular type's unary minus operator being applied
	to an integer literal, ignore integer literals for which
	Comes_From_Source is False.
  • [DBH] gcc/ada/sem_res.adb
  • 10 August 2023 at 22:39

ada: Compiler hangs on invalid postcondition

10 August 2023 at 23:21
ada: Compiler hangs on invalid postcondition

In some cases involving an illegal reference to F'Result in
the postcondition for a function not named F, the compiler would
hang instead of correctly diagnosing the error.

gcc/ada/

	* sem_attr.adb (Denote_Same_Function): Handle the case where
	Has_Homonym (Pref_Id) returns True but Homonym (Pref_Id) returns
	an empty result.
  • [DBH] gcc/ada/sem_attr.adb
  • 10 August 2023 at 23:21

ada: New Local_Restrictions and User_Aspect aspects.

10 August 2023 at 21:11
ada: New Local_Restrictions and User_Aspect aspects.

A GNAT-defined aspect, Local_Restrictions, is defined.
This provides a way of enforcing a given restriction for an individual
subprogram (and its call-closure) without requiring that the entire
program satisfy the restriction.
A GNAT-defined aspect, User_Aspect, is defined.
This (along with the new User_Aspect_Definition configuration pragma) provides
a way of naming a set of aspect specifications which can then be applied
to multiple declarations without textual repetition of the set.

gcc/ada/

	* local_restrict.ads: A new package. Declares Local_Restriction
	enumeration type and provides operations to check for local
	restriction violations.
	* local_restrict.adb: Corresponding package body. Replace "not
	Present (X)" calls with "No (X)" calls.
	* aspects.ads: Add a new enumeration elements,
	Aspect_Local_Restrictions and Aspect_User_Aspect, to the Aspect_Id
	enumeration type. Update Aspect_Id-indexed aggregates. Add nested
	package User_Aspect_Support to manage two pieces of state. One is
	a map from identifiers to User_Aspect_Definition pragmas (updated
	when such a pragma is encountered). The other is an
	access-to-subprogram variable that is introduced in order to keep
	the bulk of semantics out of the closure of package Aspects while
	allowing a call from aspects.adb to the sem_ch13 procedure that
	analyzes a User_Aspect aspect specification.
	* aspects.adb (Find_Aspect): Cope with a case of a block statement
	with an empty parent. It is not clear whether this is papering
	over a compiler bug. Add indirect call through the aforementioned
	access-to-subprogram variable when Find_Aspect enounters an
	unanalyzed User_Aspect aspect specification. If Find_Aspect is
	called looking for aspect Foo, then a User_Aspect specification
	might generate (during analysis) a Foo aspect specification. So
	the Find_Aspect call needs to trigger that analysis if it has not
	already taken place. Provide a body for package
	User_Aspect_Support. Replace "not Present (X)" call with "No (X)"
	call.
	* freeze.adb (Freeze_Subprogram): Check local restriction
	compatibility when a dispatching operation is overridden.
	* par-prag.adb: Add support for parsing a User_Aspect_Definition
	pragma.
	* restrict.ads: We'd like to have the body of package Restrict
	include a call to a procedure declared in package Local_Restrict.
	Doing that in the obvious way pulls most of semantics into the
	closure of package Restrict, and that turns out to cause problems.
	So we introduce a level of indirection and instead call through an
	access-to-subprogram value. In this unit, we declare the
	access-to-subprogram type and object.
	* restrict.adb (Check Restriction): When a construct is
	encountered that could violate a global restriction (depending on
	whether the given restriction is in effect), Check_Restriction is
	called. At this point, we also check for a violation of any
	corresponding local restriction that is in effect. For reasons
	described above, this check is performed via an indirect call.
	* sem_ch13.ads (Parse_Aspect_Local_Restrictions): A new function,
	similar to the existing Parse_Aspect_Xxx subprograms.
	* sem_ch13.adb: Perform semantic analysis of Local_Restrictions
	and User_Aspect aspect specifications. Declare and call new
	Validate_Aspect_Local_Restrictions and
	Analyze_User_Aspect_Aspect_Specification procedures (a reference
	to the latter is registered during package elaboration). In
	Analyze_Aspect_Specifications, do not set the Analyzed flag of a
	User_Aspect aspect specification. Replace "not Present (X)" call
	with "No (X)" call. Replace 'Image with 'Img in a case where the
	prefix of the attribute reference is an object; this is done to
	accomodate older compilers.
	* sem_ch6.adb (Check_Subtype_Conformant): Include in subtype
	conformance check a check for overriding-related compatibility of
	local restrictions.
	* sem_ch8.adb (Analyze_Subprogram_Renaming): In the case of an
	instance of a generic that takes a formal subprogram, check that
	formal and actual are compatible with respect to local
	restrictions.
	* sem_prag.adb: Add support for User_Aspect_Definition pragma.
	* sem_res.adb (Resolve_Call): Check caller/callee compatibility
	with respect to local restrictions.
	* snames.ads-tmpl: Add Name_Local_Restrictions, Name_User_Aspect,
	and Name_User_Aspect_Definition constants.
	* doc/gnat_rm/implementation_defined_aspects.rst: Document new
	aspects.
	* doc/gnat_rm/implementation_defined_pragmas.rst: Document new
	pragma.
	* doc/gnat_ugn/the_gnat_compilation_model.rst: Add
	User_Aspect_Definition to list of GNAT pragmas.
	* gcc-interface/Make-lang.in: Add local_restrict.o.
	* gnat-style.texi: Regenerate.
	* gnat_rm.texi: Regenerate.
	* gnat_ugn.texi: Regenerate.
  • [DBH] gcc/ada/aspects.adb
  • [DBH] gcc/ada/aspects.ads
  • [DBH] gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst
  • [DBH] gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
  • [DBH] gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst
  • [DBH] gcc/ada/freeze.adb
  • [DBH] gcc/ada/gcc-interface/Make-lang.in
  • [DBH] gcc/ada/gnat-style.texi
  • [DBH] gcc/ada/gnat_rm.texi
  • [DBH] gcc/ada/gnat_ugn.texi
  • [DBH] gcc/ada/local_restrict.adb
  • [DBH] gcc/ada/local_restrict.ads
  • [DBH] gcc/ada/par-prag.adb
  • [DBH] gcc/ada/restrict.adb
  • [DBH] gcc/ada/restrict.ads
  • [DBH] gcc/ada/sem_ch13.adb
  • [DBH] gcc/ada/sem_ch13.ads
  • [DBH] gcc/ada/sem_ch6.adb
  • [DBH] gcc/ada/sem_ch8.adb
  • [DBH] gcc/ada/sem_prag.adb
  • [DBH] gcc/ada/sem_res.adb
  • [DBH] gcc/ada/snames.ads-tmpl
  • 10 August 2023 at 21:11

ada: Deep delta aggregates

22 September 2023 at 18:54
ada: Deep delta aggregates

Add support for "deep" delta aggregates, a GNAT-defined language extension
conditionally enabled via the -gnatX0 switch. In a deep delta aggregate, a
delta choice may specify a subcomponent (as opposed to just a component).

gcc/ada/

	* par.adb: Add new Boolean variable Inside_Delta_Aggregate.
	* par-ch4.adb (P_Simple_Expression): Add support for a deep delta
	aggregate choice. We turn a sequence of selectors into a peculiar
	tree. We build a component (Indexed or Selected) whose prefix is
	another such component, etc. The leftmost prefix at the bottom of
	the tree has a "name" which is the first selector, without any
	further prefix. For something like "with delta (1)(2) => 3" where
	the type of the aggregate is an array of arrays of integers, we'll
	build an N_Indexed_Component whose prefix is an integer literal 1.
	This is consistent with the trees built for "regular"
	(Ada-defined) delta aggregates.
	* sem_aggr.adb (Is_Deep_Choice, Is_Root_Prefix_Of_Deep_Choice):
	New queries.
	(Resolve_Deep_Delta_Assoc): new procedure.
	(Resolve_Delta_Array_Aggregate): call Resolve_Deep_Delta_Assoc in
	deep case.
	(Resolve_Delta_Record_Aggregate): call Resolve_Deep_Delta_Assoc in
	deep case.
	(Get_Component_Type): new function replaces old Get_Component
	function.
	* sem_aggr.ads (Is_Deep_Choice, Is_Root_Prefix_Of_Deep_Choice):
	New queries.
	* exp_aggr.adb (Expand_Delta_Array_Aggregate): add nested function
	Make_Array_Delta_Assignment_LHS; call it instead of
	Make_Indexed_Component.
	(Expand_Delta_Record_Aggregate): add nested function
	Make_Record_Delta_Assignment_LHS; call it instead of
	Make_Selected_Component.
	* exp_spark.adb (Expand_SPARK_Delta_Or_Update): Insert range
	checks for indexes in deep delta aggregates.
  • [DBH] gcc/ada/exp_aggr.adb
  • [DBH] gcc/ada/exp_spark.adb
  • [DBH] gcc/ada/par-ch4.adb
  • [DBH] gcc/ada/par.adb
  • [DBH] gcc/ada/sem_aggr.adb
  • [DBH] gcc/ada/sem_aggr.ads
  • 22 September 2023 at 18:54

ada: Deep delta aggregates cleanup.

23 October 2023 at 21:45
ada: Deep delta aggregates cleanup.

Cleanup after the introduction of deep delta aggregates.
Eliminate a new gnatcheck message.

gcc/ada/

	* sem_aggr.adb: Replace "not Present (...)" call with "No (...)" call.
  • [DBH] gcc/ada/sem_aggr.adb
  • 23 October 2023 at 21:45

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: 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: Name resolution in expanded instances

3 November 2023 at 23:00
ada: Name resolution in expanded instances

In building the tree for an instance of a generic, expansion sets
entity fields on names that refer to things declared outside of the
instance, but leaves the entity field unset on names that should end
up referring to things declared within the instance. These will instead be
set by analysis - the idea is that if a name resolves a certain way in the
generic, then we should get corresponding results if we resolve the
corresponding name in an instance. For this to work, we have to prevent
unrelated declarations that happen to be visible at the point of the
instantiation from participating in resolution. Add code to filter out such
unwanted name resolution candidates.

gcc/ada/

	* sem_ch8.adb (Find_Direct_Name): In the case of a resolving a
	name that occurs within an instantiation, add code to detect and
	filter out unwanted candidate resolutions. The filtering is
	performed via a call to Remove_Interp.
  • [DBH] gcc/ada/sem_ch8.adb
  • 3 November 2023 at 23:00

ada: Constant_Indexing used when context requires a variable

14 November 2023 at 21:33
ada: Constant_Indexing used when context requires a variable

In the case of a call with a formal parameter of mode other than "IN"
where the corresponding actual parameter is a generalized indexing
and the indexable container has both Constant_Indexing and Variable_Indexing
aspects specified, the generalized indexing must be interpreted as a
variable indexing, not as a constant indexing. In some cases involving a
call to a prefixed view of a subprogram, this was not handled correctly.
This error results in spurious compile-time error messages saying that
the actual parameter in the call "must be a variable".

gcc/ada/

	* sem_ch4.adb (Constant_Indexing_OK): As a temporary stopgap,
	return False in the case of an unanalyzed prefixed-view call.
  • [DBH] gcc/ada/sem_ch4.adb
  • 14 November 2023 at 21:33

ada: Support Put_Image for types in user-defined instances of predefined generics.

14 November 2023 at 22:34
ada: Support Put_Image for types in user-defined instances of predefined generics.

Predefined units do not generally support the Put_Image attribute.
There are good reasons for this in most cases. But if a user-defined
instantiation of a predefined generic occurs in Ada 2022 code, then
Put_Image can be supported for types declared therein. Add this support.

gcc/ada/

	* exp_put_image.adb (Put_Image_Enabled): Return True in more
	cases. In particular, when testing to see if a type occurs in a
	predefined unit, test the type's code unit
	(obtained by calling Get_Code_Unit). In the case of type within a
	user-defined instance of a predefined generic, Is_Predefined_Unit
	will return True for the type and False for the type's code unit.
  • [DBH] gcc/ada/exp_put_image.adb
  • 14 November 2023 at 22:34

ada: Too-strict conformance checking for formal discriminated type

15 November 2023 at 21:13
ada: Too-strict conformance checking for formal discriminated type

The discriminant subtype conformance check for an actual parameter
corresponding to a generic formal discriminated type was too strict and
could incorrectly reject legal instantiations.

gcc/ada/

	* sem_ch12.adb (Validate_Discriminated_Formal_Type): Replace
	Entity_Id equality test with a call to Subtypes_Match. Distinct
	subtypes which are statically matching should pass this test.
	(Check_Discriminated_Formal): Replace Entity_Id equality test with
	a call to Subtypes_Statically_Match (preceded by a check that the
	preconditions for the call are satisfied).
  • [DBH] gcc/ada/sem_ch12.adb
  • 15 November 2023 at 21:13

ada: Add comment describing Partition_Elaboration_Policy dependency.

16 November 2023 at 23:01
ada: Add comment describing Partition_Elaboration_Policy dependency.

Add a comment in the spec for the default (as opposed to hie) version of
Ada.Real_Time.Timing_Events indicating that it is incompatible with a
a Partition_Elaboration_Policy specification specifying a policy other than
Concurrent.

gcc/ada/

	* libgnarl/a-rttiev.ads: add a comment
  • [DBH] gcc/ada/libgnarl/a-rttiev.ads
  • 16 November 2023 at 23:01
โŒ
โŒ