aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-02-01 12:35:08 +0100
committerEric Botcazou <ebotcazou@adacore.com>2023-09-27 10:16:24 +0200
commit3959b731971ef57c3e27855e54bddefa2fa5d9d5 (patch)
treee7cb703de327e415739352d6444471f24a5bc3cf /gcc
parent54a16c276e5a4bb630087651d063a96224e821df (diff)
downloadgcc-3959b731971ef57c3e27855e54bddefa2fa5d9d5.zip
gcc-3959b731971ef57c3e27855e54bddefa2fa5d9d5.tar.gz
gcc-3959b731971ef57c3e27855e54bddefa2fa5d9d5.tar.bz2
ada: Fix error and crash on imported function with precondition and 'Base
This fixes a spurious error on an imported function with a precondition and a parameter declared with a 'Base formal type, and even a crash in the case where this function is declared in a generic package. gcc/ada/ * freeze.adb (Wrap_Imported_Subprogram): Use Copy_Subprogram_Spec to copy the spec from the subprogram to the generated subprogram body. (Freeze_Entity): Do not wrap imported subprograms inside generics.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/freeze.adb7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index f54ae05..df3b5ec 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -6127,8 +6127,7 @@ package body Freeze is
Bod :=
Make_Subprogram_Body (Loc,
- Specification =>
- Copy_Separate_Tree (Spec),
+ Specification => Copy_Subprogram_Spec (Spec),
Declarations => New_List (
Make_Subprogram_Declaration (Loc,
Specification => Copy_Separate_Tree (Spec)),
@@ -6438,7 +6437,9 @@ package body Freeze is
-- Check for needing to wrap imported subprogram
- Wrap_Imported_Subprogram (E);
+ if not Inside_A_Generic then
+ Wrap_Imported_Subprogram (E);
+ end if;
-- Freeze all parameter types and the return type (RM 13.14(14)).
-- However skip this for internal subprograms. This is also where