diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-11-17 10:48:41 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-11-18 10:22:06 +0100 |
commit | 27d8c3516b67c0f5a8fe8970d0558ee3b97e8281 (patch) | |
tree | 915f1bb7526195a5ea70a21f4779fe17d70efdaf /gcc/d | |
parent | fa9091ad93b2ec6f2580e9f9c7de799fa404cf2e (diff) | |
download | gcc-27d8c3516b67c0f5a8fe8970d0558ee3b97e8281.zip gcc-27d8c3516b67c0f5a8fe8970d0558ee3b97e8281.tar.gz gcc-27d8c3516b67c0f5a8fe8970d0558ee3b97e8281.tar.bz2 |
d: Fix a couple of ICEs found in the dmd front-end (PR97842)
- Segmentation fault on incomplete static if.
- Segmentation fault resolving typeof() expression when gagging is on.
Reviewed-on: https://github.com/dlang/dmd/pull/11971
gcc/d/ChangeLog:
PR d/97842
* dmd/MERGE: Merge upstream dmd b6a779e49
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/dmd/MERGE | 2 | ||||
-rw-r--r-- | gcc/d/dmd/cond.c | 4 | ||||
-rw-r--r-- | gcc/d/dmd/mtype.c | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index e2a0bab..b00cb82 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -95044d8e45a4320f07d9c75b4eb30e55688a8195 +b6a779e49a3bba8be6272e6730e14cbb6293ef77 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/cond.c b/gcc/d/dmd/cond.c index beda133..9f76e83 100644 --- a/gcc/d/dmd/cond.c +++ b/gcc/d/dmd/cond.c @@ -705,6 +705,10 @@ int StaticIfCondition::include(Scope *sc) sc = sc->push(sc->scopesym); bool errors = false; + + if (!exp) + goto Lerror; + bool result = evalStaticCondition(sc, exp, exp, errors); sc->pop(); diff --git a/gcc/d/dmd/mtype.c b/gcc/d/dmd/mtype.c index bc66be0..6f0195a 100644 --- a/gcc/d/dmd/mtype.c +++ b/gcc/d/dmd/mtype.c @@ -7418,6 +7418,12 @@ void TypeTypeof::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol //printf("TypeTypeof::resolve(sc = %p, idents = '%s')\n", sc, toChars()); //static int nest; if (++nest == 50) *(char*)0=0; + if (sc == NULL) + { + *pt = Type::terror; + error(loc, "Invalid scope."); + return; + } if (inuse) { inuse = 2; |