From 5767d76f8f1ee56b68e794ccb65a720a8a3581c7 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sun, 16 Jun 2019 07:50:31 +0000 Subject: re PR d/90863 (ICE in StatementSemanticVisitor::visit, at d/dmd/statementsem.c:1992) PR d/90863 d/dmd: Merge upstream dmd 6e44734cc Fixes segmentation fault in StatementSemanticVisitor::visit. Reviewed-on: https://github.com/dlang/dmd/pull/10033 From-SVN: r272352 --- gcc/d/dmd/MERGE | 2 +- gcc/d/dmd/blockexit.c | 2 ++ gcc/d/dmd/statementsem.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'gcc/d') diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 4111fc9..0620a5b 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -7afcc60c30554e452eacdfbefc4951ebf601fccd +6e44734ccbeb78252a52e129a67fefb313679948 The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/blockexit.c b/gcc/d/dmd/blockexit.c index e9d3f10..c3b60b8 100644 --- a/gcc/d/dmd/blockexit.c +++ b/gcc/d/dmd/blockexit.c @@ -496,6 +496,8 @@ int blockExit(Statement *s, FuncDeclaration *func, bool mustNotThrow) } }; + if (!s) + return BEfallthru; BlockExit be(func, mustNotThrow); s->accept(&be); return be.result; diff --git a/gcc/d/dmd/statementsem.c b/gcc/d/dmd/statementsem.c index 167836c..143864dc6 100644 --- a/gcc/d/dmd/statementsem.c +++ b/gcc/d/dmd/statementsem.c @@ -2035,7 +2035,7 @@ public: ss->_body = semantic(ss->_body, sc); sc->noctor--; - if (conditionError || ss->_body->isErrorStatement()) + if (conditionError || (ss->_body && ss->_body->isErrorStatement())) goto Lerror; // Resolve any goto case's with exp @@ -2111,7 +2111,7 @@ public: { ss->hasNoDefault = 1; - if (!ss->isFinal && !ss->_body->isErrorStatement()) + if (!ss->isFinal && (!ss->_body || !ss->_body->isErrorStatement())) ss->error("switch statement without a default; use 'final switch' or add 'default: assert(0);' or add 'default: break;'"); // Generate runtime error if the default is hit -- cgit v1.1