From: Piotr Trojanek Date: Fri, 24 Oct 2025 21:12:45 +0000 (+0200) Subject: ada: Ignore declarations of internal types in compile-time evaluation X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=093c03fcd015b163bf5d86dd1e7eeb08737d58fe;p=thirdparty%2Fgcc.git ada: Ignore declarations of internal types in compile-time evaluation One more case where compile-time evaluation can't trace the original location of an object reference. gcc/ada/ChangeLog: * exp_util.adb (Find_In_Enclosing_Context): Give up on declarations of internal types. --- diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 15e956469d4..c5c70daac17 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -7395,6 +7395,18 @@ package body Exp_Util is end if; pragma Assert (Present (Current)); + -- For declarations of internal types we can't trace their origin + -- like we do for itypes, so give up. They might be coming from + -- condition of the current IF statement and will be prepended + -- before that statement itself. + + elsif Nkind (Current) = N_Subtype_Declaration + and then Is_Internal (Defining_Identifier (Current)) + then + pragma Assert (Is_Rewrite_Insertion (Current)); + Current := Empty; + return; + -- Same for itypes that have no declaration elsif Nkind (Current) = N_Defining_Identifier