Normal view

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

ada: Fix late finalization for function call in delta aggregate

27 August 2023 at 07:34
ada: Fix late finalization for function call in delta aggregate

The problem occurs at library level because the temporary created for the
function call lives in the elaboration routine but is finalized only when
the package itself is.

It turns out that there is no need for this temporary, since the expansion
of delta aggregates already creates a (properly finalized) temporary.

gcc/ada/

	* exp_ch6.adb (Expand_Ctrl_Function_Call): Also do nothing for the
	expression of a delta aggregate.
  • [DBH] gcc/ada/exp_ch6.adb
  • 27 August 2023 at 07:34

ada: Improve detection of deactivated code for warnings with -gnatwt

4 August 2023 at 13:01
ada: Improve detection of deactivated code for warnings with -gnatwt

Switch -gnatwt is used in GNAT to track deleted code. It can be emitted
by GNAT on code that is intentionally deactivated for a given configuration.
The current test to suppress spurious warnings is not complex enough to
detect all such cases. Now improved, by using the same test as used in
GNATprove to suppress warnings related to a "statically disabled condition
which evaluates to a given value", as described in SPARK UG 7.3.2.

gcc/ada/

	* exp_util.adb (Is_Statically_Disabled): New function to detect a
	"statically disabled condition which evaluates to a given value",
	as described in SPARK UG 7.3.2.
	(Kill_Dead_Code): Call the new function Is_Statically_Disabled for
	conditions of if statements.
	* exp_util.ads (Is_Statically_Disabled): New function spec.
  • [DBH] gcc/ada/exp_util.adb
  • [DBH] gcc/ada/exp_util.ads
  • 4 August 2023 at 13:01

ada: Remove redundant protection against empty list

23 August 2023 at 14:44
ada: Remove redundant protection against empty list

Calls to First on No_List intentionally return Empty, so explicit guards
against No_List are unnecessary. Code cleanup; semantics is unaffected.

gcc/ada/

	* sem_type.adb (Interface_Present_In_Ancestor): Remove guard against no
	list of interfaces; fix style in comments (trailing dots).
  • [DBH] gcc/ada/sem_type.adb
  • 23 August 2023 at 14:44

ada: Add guard before querying the type for its interfaces

23 August 2023 at 14:02
ada: Add guard before querying the type for its interfaces

Fix crash on illegal code, when routine Iface_Present_In_Ancestor is
called on the predefined String type and attempts to examine the list of
interfaces.

gcc/ada/

	* sem_type.adb (Iface_Present_In_Ancestor): Only look at the list of
	interfaces for types that allow it. The guard is a high-level equivalent
	of the entity kinds listed in the preconditon of the Interfaces query.
  • [DBH] gcc/ada/sem_type.adb
  • 23 August 2023 at 14:02

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: Fix DWARF for certain arrays

21 August 2023 at 17:11
ada: Fix DWARF for certain arrays

An array whose index type is a nonstandard enum will be marked as
"packed", but should not emit DW_AT_bit_stride unless it is also
bit-packed.

gcc/ada/

	* gcc-interface/decl.cc (gnat_to_gnu_entity): Set bit-packed for
	constrained and unconstrained array types.
	* gcc-interface/misc.cc (gnat_get_array_descr_info): Examine
	BIT_PACKED_ARRAY_TYPE_P.
  • [DBH] gcc/ada/gcc-interface/decl.cc
  • [DBH] gcc/ada/gcc-interface/misc.cc
  • 21 August 2023 at 17:11

ada: Fix assertion failure on very peculiar enumeration type

21 August 2023 at 16:23
ada: Fix assertion failure on very peculiar enumeration type

The compiler currently does not support the combination of a representation
clause on an enumeration type with a size clause whose value is greater than
the size of the largest machine scalar supported by the target.

Given that such a type would have little practical value, this change causes
the compiler to give a proper error message instead of aborting.

gcc/ada/

	* freeze.adb (Freeze_Enumeration_Type): Give an error on a type with
	both representation clause and too large size.
  • [DBH] gcc/ada/freeze.adb
  • 21 August 2023 at 16:23

ada: Fix spurious warning emissions

21 August 2023 at 11:35
ada: Fix spurious warning emissions

Before this patch, warnings handled by `Sem_Warn.Check_References` were
erroneously emitted in some cases. Here is an example of a program that,
when compiled with the `-gnatwu` switch, triggered the bug:

    procedure Main is
       package T is
          A : Integer;
       end T;
    begin
       T.A := 7;
    end Main;

The following message was emitted:

   main.adb:3:07: warning: variable "A" is never read and never assigned [-gnatwu]

This patch mitigates the issue by restricting the cases in which
`Sem_Warn.Check_References` is called for package specifications.

Note that the recursive calls in `Sem_Warn.Check_References` can be used
to convince oneself that this patch does not remove legitimate warnings
for non-library-level package specifications.

gcc/ada/

	* sem_ch7.adb (Analyze_Package_Declaration): Restrict calls to
	`Sem_Warn.Check_References` and adjust comment accordingly.
  • [DBH] gcc/ada/sem_ch7.adb
  • 21 August 2023 at 11:35

ada: Crash on creation of extra formals on type extension

19 August 2023 at 16:50
ada: Crash on creation of extra formals on type extension

The compiler blows up processing an overriding dispatching function
of a derived tagged type that returns a private tagged type that
has an access type discriminant.

gcc/ada/

	* accessibility.ads (Needs_Result_Accessibility_Extra_Formal): New
	subprogram.
	* accessibility.adb (Needs_Result_Accessibility_Level_Param): New
	subprogram.
	(Needs_Result_Accessibility_Extra_Formal): New subprogram,
	temporarily keep the previous behavior of the frontend.
	* sem_ch6.adb (Create_Extra_Formals): Replace occurrences of
	function Needs_Result_Accessibility_Level_Param by calls to
	function Needs_Result_Accessibility_Extra_Formal.
	(Extra_Formals_OK): Ditto.
  • [DBH] gcc/ada/accessibility.adb
  • [DBH] gcc/ada/accessibility.ads
  • [DBH] gcc/ada/sem_ch6.adb
  • 19 August 2023 at 16:50

ada: Crash on function returning empty Ada 2022 aggregate

15 August 2023 at 12:57
ada: Crash on function returning empty Ada 2022 aggregate

The compiler crashes processing a function that returns an empty
aggregate when its returned type is a record type which defined
its container aggregate aspects.

gcc/ada/

	* exp_aggr.adb (Expand_Container_Aggregate): Report warning on
	infinite recursion if an empty container aggregate appears in the
	return statement of its Empty function. Fix typo in comment.
	* sem_aggr.adb (Resolve_Aggregate): Resolve Ada 2022 empty
	aggregate that initializes a record type that has defined its
	container aggregate aspects.
	(Resolve_Iterated_Association): Protect access to attribute Etype.
	* sem_ch13.adb (Resolve_Aspect_Aggregate): Fix typo in comment.
  • [DBH] gcc/ada/exp_aggr.adb
  • [DBH] gcc/ada/sem_aggr.adb
  • [DBH] gcc/ada/sem_ch13.adb
  • 15 August 2023 at 12:57
❌
❌