diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-05-02 10:57:44 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-05-02 10:57:44 +0200 |
commit | a6354842df32417f55a9635e98f7e00bd412e13a (patch) | |
tree | 5a69566d8d4c6344cb126c05daa04be0c33e4494 /gcc/ada/sem_ch4.adb | |
parent | 97ac2d62fa6fc002ff9f7ddee620e2bdaaa1cde8 (diff) | |
download | gcc-a6354842df32417f55a9635e98f7e00bd412e13a.zip gcc-a6354842df32417f55a9635e98f7e00bd412e13a.tar.gz gcc-a6354842df32417f55a9635e98f7e00bd412e13a.tar.bz2 |
[multiple changes]
2017-05-02 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch6.adb (Analyze_Null_Procedure): Revert previous change.
2017-05-02 Justin Squirek <squirek@adacore.com>
* sem_ch4.adb (Analyze_Case_Expression): Add check for valid
expression (Analyze_If_Expression): Add check for valid condition
* sem_eval.adb (Eval_Case_Expression): Add check for error posted
on case-expression
* sem_res.adb (Resolve_If_Expression): Add check for valid
condition and then-expression.
From-SVN: r247477
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r-- | gcc/ada/sem_ch4.adb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 8a94f3f..3952789 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -1560,6 +1560,10 @@ package body Sem_Ch4 is -- Get our initial type from the first expression for which we got some -- useful type information from the expression. + if No (FirstX) then + return; + end if; + if not Is_Overloaded (FirstX) then Set_Etype (N, Etype (FirstX)); @@ -2212,23 +2216,28 @@ package body Sem_Ch4 is procedure Analyze_If_Expression (N : Node_Id) is Condition : constant Node_Id := First (Expressions (N)); - Then_Expr : constant Node_Id := Next (Condition); + Then_Expr : Node_Id; Else_Expr : Node_Id; begin -- Defend against error of missing expressions from previous error + if No (Condition) then + Check_Error_Detected; + return; + end if; + Then_Expr := Next (Condition); + if No (Then_Expr) then Check_Error_Detected; return; end if; + Else_Expr := Next (Then_Expr); if Comes_From_Source (N) then Check_SPARK_05_Restriction ("if expression is not allowed", N); end if; - Else_Expr := Next (Then_Expr); - if Comes_From_Source (N) then Check_Compiler_Unit ("if expression", N); end if; |