โŒ About FreshRSS

Normal view

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

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