aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2020-05-13 18:59:29 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-07 05:26:58 -0400
commit7bf53b1a612b1fe08d80d823981879486531ea11 (patch)
treeafb0f3e1fe62ef36c7915ddc571806a368144550
parent1c4b5a795ad772b0d80d18757593808044b14e90 (diff)
downloadgcc-7bf53b1a612b1fe08d80d823981879486531ea11.zip
gcc-7bf53b1a612b1fe08d80d823981879486531ea11.tar.gz
gcc-7bf53b1a612b1fe08d80d823981879486531ea11.tar.bz2
[Ada] Hang on conditional expression as actual
gcc/ada/ * exp_ch6.adb (Expand_Branch): Verify the original node is a conditional expression before recursing further. (Insert_Level_Assign): Transform assertion into an explicit raise.
-rw-r--r--gcc/ada/exp_ch6.adb10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index fb19983..3ccf0c3 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -3947,6 +3947,11 @@ package body Exp_Ch6 is
if Nkind (Expression (Assn)) =
N_Expression_With_Actions
+ and then
+ Nkind_In
+ (Original_Node (Expression (Assn)),
+ N_Case_Expression,
+ N_If_Expression)
then
Insert_Level_Assign (Expression (Assn));
@@ -3983,7 +3988,10 @@ package body Exp_Ch6 is
N_If_Statement);
Next (Cond);
- pragma Assert (Present (Cond));
+
+ if No (Cond) then
+ raise Program_Error;
+ end if;
end loop;
-- Iterate through if expression branches