aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2020-11-12 14:40:39 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-30 09:16:19 -0500
commite783561e9c10f84a9a1a23d81bb9510f961c4c61 (patch)
tree6fd76ecf9a40b14f1c99117be0a9b82b698da71f /gcc
parent2bf891fa752e18b872d6c06d541aed1ae0b94580 (diff)
downloadgcc-e783561e9c10f84a9a1a23d81bb9510f961c4c61.zip
gcc-e783561e9c10f84a9a1a23d81bb9510f961c4c61.tar.gz
gcc-e783561e9c10f84a9a1a23d81bb9510f961c4c61.tar.bz2
[Ada] Compiler crash on limited conditional expressions
gcc/ada/ * exp_ch3.adb (Expand_N_Object_Declaration): Avoid crash in case of conditional expression.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch3.adb10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index f8b6ee6..bd2de67 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -7403,12 +7403,12 @@ package body Exp_Ch3 is
-- If we cannot convert the expression into a renaming we must
-- consider it an internal error because the backend does not
- -- have support to handle it. Also, when a raise expression is
- -- encountered we ignore it since it doesn't return a value and
- -- thus cannot trigger a copy.
+ -- have support to handle it. But avoid crashing on a raise
+ -- expression or conditional expression.
- elsif Nkind (Original_Node (Expr_Q)) /= N_Raise_Expression then
- pragma Assert (False);
+ elsif Nkind (Original_Node (Expr_Q)) not in
+ N_Raise_Expression | N_If_Expression | N_Case_Expression
+ then
raise Program_Error;
end if;