https://gcc.gnu.org/g:f3c7f4ed70131116f4b32756ffa0e17e81b9c76a
commit r17-1331-gf3c7f4ed70131116f4b32756ffa0e17e81b9c76a Author: Piotr Trojanek <[email protected]> Date: Wed May 20 16:53:34 2026 +0200 ada: Check intrinsic subprograms specified by an aspect We only checked intrinsic subprograms specified by pragmas that come from source, but this missed subprograms specified by an aspect (because its internally generated corresponding pragma doesn't come from source). gcc/ada/ChangeLog: * sem_intr.adb (Check_Intrinsic_Subprogram): Recognize pragmas that do not come from source because they come from aspect specification. Diff: --- gcc/ada/sem_intr.adb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb index 0657ec7e725f..7614e8364d37 100644 --- a/gcc/ada/sem_intr.adb +++ b/gcc/ada/sem_intr.adb @@ -309,6 +309,16 @@ package body Sem_Intr is Nam : Name_Id; begin + -- Intrinsic subprograms will be accompanied by a pragma, either a one + -- that comes from source, or a one that comes from translating the + -- corresponding aspect. Generic intrinsics subprograms don't have such + -- a pragma; only their instances have. + + pragma Assert + (if Is_Subprogram (E) + then Present (Import_Pragma (E)) + else Is_Generic_Subprogram (E)); + if Present (Spec) and then Present (Generic_Parent (Spec)) then @@ -341,7 +351,9 @@ package body Sem_Intr is -- they are doing, and do not write or generate junk use of intrinsic. elsif not Comes_From_Source (E) - or else not Comes_From_Source (N) + or else (Is_Subprogram (E) + and then not Comes_From_Source (N) + and then not From_Aspect_Specification (Import_Pragma (E))) or else In_Predefined_Unit (N) then null;
