โŒ About FreshRSS

Reading view

There are new articles available, click to refresh the page.

ada: Pass -msmp when linking for ppc-vx6 --RTS=rtp-smp

ada: Pass -msmp when linking for ppc-vx6 --RTS=rtp-smp

gprbuild and gnatmake won't pass --RTS=rtp-smp to the compiler driver
for linking.  The flag was not used during linking: the .spec files
named as linker options were all we passed for the linker to get the
-L flags for lib_smp and lib.

There was a problem, though: although /lib_smp/ and /lib/ were to be
searched in this order, and the specs files did that correctly, the
compiler would search /lib/ first regardless, because
STARTFILE_PREFIX_SPEC said so, and specs files cannot override that.

With this patch, we make sure the rtp-smp runtime causes -msmp to be
added to the command line passed to the compiler driver for linking,
and a corresponding patch for the ppc-vxworks configuration makes the
GCC compiler driver use this flag to select /lib_smp/ rather than
/lib/.

gcc/ada/

	* libgnat/system-vxworks-ppc-rtp-smp.ads: Add -msmp to
	Linker_Options pragma.
  • [DBH] gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads

ada: Preserve capability validity in address arithmetic

ada: Preserve capability validity in address arithmetic

On CHERI targets where System.Address is a capability, arithmetic on
addresses should avoid converting to integers and instead use the
operations defined in System.Storage_Elements to perform the arithmetic
directly on the System.Address object. This preserves the capability's
validity throughout the calculation, ensuring that the resulting capability
can be dereferenced.

gcc/ada/

	* libgnat/s-carsi8.adb: Use operations from
	System.Storage_Elements for address arithmetic.
	* libgnat/s-carun8.adb: Likewise
	* libgnat/s-casi128.adb: Likewise
	* libgnat/s-casi16.adb: Likewise
	* libgnat/s-casi32.adb: Likewise
	* libgnat/s-casi64.adb: Likewise
	* libgnat/s-caun128.adb: Likewise
	* libgnat/s-caun16.adb: Likewise
	* libgnat/s-caun32.adb: Likewise
	* libgnat/s-caun64.adb: Likewise
	* libgnat/s-geveop.adb: Likewise
  • [DBH] gcc/ada/libgnat/s-carsi8.adb
  • [DBH] gcc/ada/libgnat/s-carun8.adb
  • [DBH] gcc/ada/libgnat/s-casi128.adb
  • [DBH] gcc/ada/libgnat/s-casi16.adb
  • [DBH] gcc/ada/libgnat/s-casi32.adb
  • [DBH] gcc/ada/libgnat/s-casi64.adb
  • [DBH] gcc/ada/libgnat/s-caun128.adb
  • [DBH] gcc/ada/libgnat/s-caun16.adb
  • [DBH] gcc/ada/libgnat/s-caun32.adb
  • [DBH] gcc/ada/libgnat/s-caun64.adb
  • [DBH] gcc/ada/libgnat/s-geveop.adb

ada: Remove GNATcheck violations

ada: Remove GNATcheck violations

Use pragma Annotate to exempt GNATcheck violations that are related
to proof code. Specifically, exempt rules "Metrics_LSLOC" and
"Metrics_Cyclomatic_Complexity" whose limits are exceeded due to
proof code, and exempt rule "Discriminated_Records" for a variant record
that is only used in proof code.

gcc/ada/

	* libgnat/s-aridou.adb: Add pragma to exempt Metrics_LSLOC.
	(Double_Divide): Add pragma to exempt
	Metrics_Cyclomatic_Complexity.
	(Scaled_Divide): Likewise.
	* libgnat/s-vauspe.ads (Uns_Option): Add pragma to exempt
	Discriminated_Records.
  • [DBH] gcc/ada/libgnat/s-aridou.adb
  • [DBH] gcc/ada/libgnat/s-vauspe.ads

ada: Fix internal error on instantiation with private component type

ada: Fix internal error on instantiation with private component type

First, this fixes an internal error on the instantiation of a nested generic
package taking an array type whose component type is a private type declared
in the parent package as formal type parameter. In the body of the instance,
the full view of the private type is visible and must be restored by means
of the Check_Generic_Actuals mechanism.

Second, this fixes the same internal error in the case where the component
type itself is an array type whose component type is a private type declared
in the parent package, i.e. when the formal type parameter is an array of
array type, by naturally extending the Has_Secondary_Private_View mechanism
to the array of array case.

gcc/ada/

	* sem_ch12.adb (Component_Type_For_Private_View): New function.
	(Check_Generic_Actuals): For an actual type parameter, also check
	its component type if it is an array type.
	(Check_Private_View): Use Component_Type_For_Private_View in the
	case of an array type.
	(Instantiate_Type): Likewise.
	(Save_Global_References.Set_Global_Type): Likewise.
  • [DBH] gcc/ada/sem_ch12.adb

ada: Support setting task affinity on QNX

ada: Support setting task affinity on QNX

QNX does not support setting the thread affinity via a POSIX API.
This implementation uses QNX's native Thread_Ctl API to set the
thread affinity for Ada tasks.

gcc/ada/

	* libgnarl/s-taprop__qnx.adb: Implement Set_Task_Affinity.
  • [DBH] gcc/ada/libgnarl/s-taprop__qnx.adb

ada: Spurious warning about negative modular literal

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

ada: Compiler hangs on invalid postcondition

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

ada: Crash on function returning empty Ada 2022 aggregate

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

ada: Crash on creation of extra formals on type extension

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

ada: Fix spurious warning emissions

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

ada: Fix assertion failure on very peculiar enumeration type

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

ada: Fix DWARF for certain arrays

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

ada: Add guard before querying the type for its interfaces

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

ada: Remove redundant protection against empty list

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