โŒ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Today โ€” 28 November 2023Change logs

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
Before yesterdayChange logs

ada: Compiler crash on early alignment clause

By: Bob Duff
18 October 2023 at 13:54
ada: Compiler crash on early alignment clause

This patch fixes a bug: if "for T'Alignment use..." is followed
by "for T use (<enum rep>);" the compiler crashes. A workaround is
to move the alignment clause after the enumeration rep clause.

gcc/ada/

	* sem_ch13.ads (Set_Enum_Esize): Do not set alignment.
	* sem_ch13.adb (Set_Enum_Esize): Do not set alignment. Archaeology
	seems to show that this line of code dates from when "Alignment =
	0" meant "the Alignment is not known at compile time" and "the
	Alignment is not yet known at compile time" as well as "the
	Alignment is zero". In any case, it seems to be unnecessary, and
	in this case harmful, because gigi would crash. Alignment_Clause
	is set (because there is one), so gigi would query the Alignment,
	but Alignment was destroyed.
  • [DBH] gcc/ada/sem_ch13.adb
  • [DBH] gcc/ada/sem_ch13.ads
  • 18 October 2023 at 13:54

ada: Error in prefix-notation call

By: Bob Duff
12 October 2023 at 19:52
ada: Error in prefix-notation call

The compiler gives a wrong error for a call of the form X.Y(...)
when Y is inherited indirectly via an interface.

gcc/ada/

	* sem_ch4.adb (Is_Private_Overriding): Return True in the case
	where a primitive operation is publicly inherited but privately
	overridden.
  • [DBH] gcc/ada/sem_ch4.adb
  • 12 October 2023 at 19:52

ada: Clean up scope depth and related code (tech debt)

By: Bob Duff
5 September 2023 at 18:40
ada: Clean up scope depth and related code (tech debt)

The main point of this patch is to remove the special case
for Atree.F_Scope_Depth_Value in the Assert that Field_Present
in Get_Field_Value. Pulling on that thread leads to lots
of related cleanup.

gcc/ada/ChangeLog:

	* atree.adb (Node_Kind_Table): Specify parameter explicitly in
	GNAT.Table instantiations. Use fully qualified references instead
	of relying on use clauses.
	(Get_Field_Value): Remove special case for F_Scope_Depth_Value.
	That is, enable the Field_Present check in that case.
	(It was already enabled for all other fields.) Violations of this
	check were already fixed.
	(Print_Node_Statistics): Sort the output in decreasing order of
	frequencies.
	(Print_Field_Statistics): Likewise (sort).
	* accessibility.adb (Accessibility_Level): Pass Allow_Alt_Model in
	recursive calls. Apparently, an oversight.
	(Innermost_Master_Scope_Depth): Need to special-case the 'Old
	attribute and allocators.
	* einfo-utils.ads (Scope_Depth): Use Scope_Kind_Id to get
	predicate checks.
	(Scope_Depth_Set): Likewise.
	(Scope_Depth_Default_0): Likewise.
	* einfo-utils.adb: As for spec.
	* frontend.adb (Frontend): Remove unnecessary "return;".
	* gen_il-types.ads (Scope_Kind): New union type.
	* gen_il-gen-gen_entities.adb (Scope_Kind): New union type.
	* sem.ads: Move "with Einfo.Entities;" from body to spec.
	(Scope_Stack_Entry): Declare Entity to be of Scope_Kind_Id to get
	predicate checks. We had previously been putting non-scopes on the
	scope stack; this prevents such anomalies.
	* sem.adb: Move "with Einfo.Entities;" from body to spec.
	* sem_ch8.ads: Move "with Einfo.Entities;" from body to spec. Add
	"with Types;".
	(Push_Scope): Use Scope_Kind_Id to get predicate checks.
	* sem_ch8.adb: Move "with Einfo.Entities;" from body to spec. Add
	"with Types;".
	(Push_Scope): Use Scope_Kind_Id to get predicate checks.
	(Pop_Scope): Use Scope_Kind_Id on popped entity to get predicate
	checks. This prevents anomalies where a scope pushed onto the
	stack is later mutated to a nonscope before being popped.
	* sem_util.ads (Find_Enclosing_Scope): Add postcondition to ensure
	that the enclosing scope of a node N is not the same node N.
	Clearly, N does not enclose itself.
	* sem_util.adb (Find_Enclosing_Scope): There were several bugs
	where Find_Enclosing_Scope(N) = N. For example, if N is an entity,
	then we would typically go up to its declaration, and then back
	down to the Defining_Entity of the declaration, which is N itself.
	There were other cases where Find_Enclosing_Scope of an entity
	disagreed with Scope. Clearly, Find_Enclosing_Scope and Scope
	should agree (when both are defined). Such bugs caused latent bugs
	in accessibility.adb related to 'Old, and fixing bugs here caused
	such bugs to be revealed. These are fixed by calling Scope when N
	is an entity.

Co-authored-by: Ronan Desplanques <[email protected]>
  • [DBH] gcc/ada/accessibility.adb
  • [DBH] gcc/ada/atree.adb
  • [DBH] gcc/ada/einfo-utils.adb
  • [DBH] gcc/ada/einfo-utils.ads
  • [DBH] gcc/ada/frontend.adb
  • [DBH] gcc/ada/gen_il-gen-gen_entities.adb
  • [DBH] gcc/ada/gen_il-types.ads
  • [DBH] gcc/ada/sem.adb
  • [DBH] gcc/ada/sem.ads
  • [DBH] gcc/ada/sem_ch8.adb
  • [DBH] gcc/ada/sem_ch8.ads
  • [DBH] gcc/ada/sem_util.adb
  • [DBH] gcc/ada/sem_util.ads
  • 5 September 2023 at 18:40

ada: Fix crash on selected component lookup in generic instance

By: Bob Duff
23 August 2023 at 12:14
ada: Fix crash on selected component lookup in generic instance

This patch fixes a compiler crash on selected component lookup in an instance
of a generic unit when the relevant type is an itype.

gcc/ada/

	* sem_ch4.adb (Find_Component_In_Instance): Check that
	Declaration_Node (Par) is not Empty, as it is for itypes.
  • [DBH] gcc/ada/sem_ch4.adb
  • 23 August 2023 at 12:14

ada: check Atree.Get/Set_Field_Value

By: Bob Duff
10 May 2023 at 19:21
ada: check Atree.Get/Set_Field_Value

Get_Field_Value and Set_Field_Value now check that the Nkind or Ekind is
correct. However, the checks are partially disabled, because they
sometimes fail.

gcc/ada/

	* atree.adb (Field_Present): New function to detect whether or not
	a given field is present in a given node, based on either the node
	kind or the entity kind as appropriate.
	(Get_Field_Value): Check that the field begin fetched exists.
	However, disable the check in the case of Scope_Depth_Value,
	because we have failures in that case. Those failures need to be
	fixed, and then the check can be enabled for all fields.
	(Set_Field_Value): Check that the field begin set exists.
  • [DBH] gcc/ada/atree.adb
  • 10 May 2023 at 19:21

ada: Avoid renaming_decl in case of constrained array

By: Bob Duff
3 July 2023 at 16:01
ada: Avoid renaming_decl in case of constrained array

This patch avoids rewriting "X: S := F(...);" as "X: S renames F(...);".
That rewrite is incorrect if S is a constrained array subtype,
because it changes the semantics. In the original, the
bounds of X are that of S. But constraints are ignored in
renamings, so the bounds of X would come from F'Result.
This can cause spurious Constraint_Errors in some obscure
cases. It causes unnecessary checks to be inserted, and even
when such checks pass (more common case), they might be less
efficient.

gcc/ada/

	* exp_ch3.adb (Expand_N_Object_Declaration): Avoid transforming to
	a renaming in case of constrained array that comes from source.
  • [DBH] gcc/ada/exp_ch3.adb
  • 3 July 2023 at 16:01
โŒ
โŒ