Commit 5767d76f by Iain Buclaw

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
parent b0a55e66
7afcc60c30554e452eacdfbefc4951ebf601fccd 6e44734ccbeb78252a52e129a67fefb313679948
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository. merge done from the dlang/dmd repository.
...@@ -496,6 +496,8 @@ int blockExit(Statement *s, FuncDeclaration *func, bool mustNotThrow) ...@@ -496,6 +496,8 @@ int blockExit(Statement *s, FuncDeclaration *func, bool mustNotThrow)
} }
}; };
if (!s)
return BEfallthru;
BlockExit be(func, mustNotThrow); BlockExit be(func, mustNotThrow);
s->accept(&be); s->accept(&be);
return be.result; return be.result;
......
...@@ -2035,7 +2035,7 @@ public: ...@@ -2035,7 +2035,7 @@ public:
ss->_body = semantic(ss->_body, sc); ss->_body = semantic(ss->_body, sc);
sc->noctor--; sc->noctor--;
if (conditionError || ss->_body->isErrorStatement()) if (conditionError || (ss->_body && ss->_body->isErrorStatement()))
goto Lerror; goto Lerror;
// Resolve any goto case's with exp // Resolve any goto case's with exp
...@@ -2111,7 +2111,7 @@ public: ...@@ -2111,7 +2111,7 @@ public:
{ {
ss->hasNoDefault = 1; 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;'"); 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 // Generate runtime error if the default is hit
......
// PERMUTE_ARGS:
/*
TEST_OUTPUT:
---
fail_compilation/fail19955.d(8): Error: `switch` statement without a `default`; use `final switch` or add `default: assert(0);` or add `default: break;`
---
*/
void f() { switch(1) static assert(1); }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment