https://gcc.gnu.org/g:093c03fcd015b163bf5d86dd1e7eeb08737d58fe
commit r16-5239-g093c03fcd015b163bf5d86dd1e7eeb08737d58fe Author: Piotr Trojanek <[email protected]> Date: Fri Oct 24 23:12:45 2025 +0200 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: --- gcc/ada/exp_util.adb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 15e956469d46..c5c70daac17e 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
