From 1788bf118c1c97a2e3cb8c0526ffe617859eb7d4 Mon Sep 17 00:00:00 2001 From: Yannick Moy Date: Tue, 13 Aug 2019 08:07:24 +0000 Subject: [PATCH] [Ada] Avoid crash in GNATprove due to inlining inside type The special inlining for GNATprove should not inline calls inside record types, used for the constraints of components. There is no impact on compilation. 2019-08-13 Yannick Moy gcc/ada/ * sem_res.adb (Resolve_Call): Do not inline calls inside record types. From-SVN: r274344 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/sem_res.adb | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 34f41fde3f0..55044f6e200 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-08-13 Yannick Moy + + * sem_res.adb (Resolve_Call): Do not inline calls inside record + types. + 2019-08-13 Eric Botcazou * sem_ch4.adb (Analyze_One_Call): Remove bypass for type diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 759887ccd31..7a9c85c2154 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -7062,6 +7062,15 @@ package body Sem_Res is end if; end if; + -- Cannot inline a call inside the definition of a record type, + -- typically inside the constraints of the type. Calls in + -- default expressions are also not inlined, but this is + -- filtered out above when testing In_Default_Expr. + + elsif Is_Record_Type (Current_Scope) then + Cannot_Inline + ("cannot inline & (inside record type)?", N, Nam_UA); + -- With the one-pass inlining technique, a call cannot be -- inlined if the corresponding body has not been seen yet. -- 2.30.2