aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2019-09-18 08:32:37 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-09-18 08:32:37 +0000
commit50a7395372ba8a082fc0514a16a3f381ec1e49e7 (patch)
tree6200def24fd5a0a9263fc111b9f44a465539f6bb
parent432a3b3644f52822cb61da7f529edf35b4390dd8 (diff)
downloadgcc-50a7395372ba8a082fc0514a16a3f381ec1e49e7.zip
gcc-50a7395372ba8a082fc0514a16a3f381ec1e49e7.tar.gz
gcc-50a7395372ba8a082fc0514a16a3f381ec1e49e7.tar.bz2
[Ada] Don't fail a front-end assertion if errors have already been detected
In sem_eval.adb, we have an assertion that the type of a "null" literal is an access type. It turns out that this assertion can fail when processing an illegal program, e.g. one that contains something like "Integer'(null)". This leads to differences in the compiler's generated output for such tests depending on whether assertions are/aren't enabled; in particular, the "compilation abandoned due to previous error" message generated in Comperr.Compiler_Abort. In order to avoid these differences, we change the assertion so that it does not fail if errors have already been posted on the given node. 2019-09-18 Steve Baird <baird@adacore.com> gcc/ada/ * sem_eval.adb (Expr_Value): Do not fail "the type of a null literal must be an access type" assertion if errors have already been posted on the given node. From-SVN: r275852
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_eval.adb3
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 8b044d1..88957a2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2019-09-18 Steve Baird <baird@adacore.com>
+
+ * sem_eval.adb (Expr_Value): Do not fail "the type of a null
+ literal must be an access type" assertion if errors have already
+ been posted on the given node.
+
2019-09-18 Piotr Trojanek <trojanek@adacore.com>
* exp_dbug.ads, exp_dbug.adb (Get_Homonym_Number): Refine type
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index 5c41642..5f26ecd 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -4278,7 +4278,8 @@ package body Sem_Eval is
-- The NULL access value
elsif Kind = N_Null then
- pragma Assert (Is_Access_Type (Underlying_Type (Etype (N))));
+ pragma Assert (Is_Access_Type (Underlying_Type (Etype (N)))
+ or else Error_Posted (N));
Val := Uint_0;
-- Character literal