aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2021-07-07 10:56:48 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-21 15:25:01 +0000
commitdbea36c6bde7bd32ad645b0d472c5674e2db744d (patch)
treee0fddf58efefa8e790163517e814a70b0cb1158e
parent1d8617eb8c089ee60000e50e53ed320b983092ea (diff)
downloadgcc-dbea36c6bde7bd32ad645b0d472c5674e2db744d.zip
gcc-dbea36c6bde7bd32ad645b0d472c5674e2db744d.tar.gz
gcc-dbea36c6bde7bd32ad645b0d472c5674e2db744d.tar.bz2
[Ada] Crash on build of Initialization procedure for derived container
gcc/ada/ * exp_ch7.adb (Make_Init_Call): Add guard to protect against a missing initialization procedure for a type.
-rw-r--r--gcc/ada/exp_ch7.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 33e4f3a..8d08ff1 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -9555,8 +9555,11 @@ package body Exp_Ch7 is
-- If initialization procedure for an array of controlled objects is
-- trivial, do not generate a useless call to it.
+ -- The initialization procedure may be missing altogether in the case
+ -- of a derived container whose components have trivial initialization.
- if (Is_Array_Type (Utyp) and then Is_Trivial_Subprogram (Proc))
+ if No (Proc)
+ or else (Is_Array_Type (Utyp) and then Is_Trivial_Subprogram (Proc))
or else
(not Comes_From_Source (Proc)
and then Present (Alias (Proc))