diff options
author | Ed Schonberg <schonberg@adacore.com> | 2020-03-30 08:26:27 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-15 04:04:20 -0400 |
commit | 9aa63bdded3b3aa7f4497cf5326e71fc03fda106 (patch) | |
tree | 08a4d798f129f956bba8d0ae46b81b36f678a325 | |
parent | 36cf595c0b8919dc261771fc5bea0c8b5614ab60 (diff) | |
download | gcc-9aa63bdded3b3aa7f4497cf5326e71fc03fda106.zip gcc-9aa63bdded3b3aa7f4497cf5326e71fc03fda106.tar.gz gcc-9aa63bdded3b3aa7f4497cf5326e71fc03fda106.tar.bz2 |
[Ada] Link failure with call to expression function in precondition
2020-06-15 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* freeze.adb (Freeze_Expression): When traversing the tree
looking for the proper insertion point for the freeze node of an
entity that is declared in an outer scope, set the candidate
subprogram body node properly. Previous code has an off-by-one
error.
-rw-r--r-- | gcc/ada/freeze.adb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 760cf7c..ea1274e 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -7379,10 +7379,16 @@ package body Freeze is return; end if; - exit when - Nkind (Parent_P) = N_Subprogram_Body + -- If the parent is a subprogram body, the candidate insertion + -- point is just ahead of it. + + if Nkind (Parent_P) = N_Subprogram_Body and then Unique_Defining_Entity (Parent_P) = - Freeze_Outside_Subp; + Freeze_Outside_Subp + then + P := Parent_P; + exit; + end if; P := Parent_P; end loop; |