aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2020-04-21 08:50:12 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2020-04-21 08:58:08 +0200
commit46cf683bf16491a0bd1d77d8b0cce0e11cf1d46f (patch)
tree10f7558f16f3c7e34cd94e28c011a94b759688ae /gcc/d/dmd
parent8e841bd419fb9dc3e027367fc11078b677541a9a (diff)
downloadgcc-46cf683bf16491a0bd1d77d8b0cce0e11cf1d46f.zip
gcc-46cf683bf16491a0bd1d77d8b0cce0e11cf1d46f.tar.gz
gcc-46cf683bf16491a0bd1d77d8b0cce0e11cf1d46f.tar.bz2
d/dmd: Merge upstream dmd 62ce36f37
Adjusts the hardcoded index of Error.bypassException. Fixes: PR d/94623 Reviewed-on: https://github.com/dlang/dmd/pull/11052
Diffstat (limited to 'gcc/d/dmd')
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/dinterpret.c19
2 files changed, 14 insertions, 7 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index cd3d48d..155286d 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-ba99ee345694da61eca7b555517d540ff3dc0a56
+62ce36f3737de691217c21f0173f411734eb1d43
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/dinterpret.c b/gcc/d/dmd/dinterpret.c
index 61f5cdb..e2d49b9 100644
--- a/gcc/d/dmd/dinterpret.c
+++ b/gcc/d/dmd/dinterpret.c
@@ -1652,21 +1652,28 @@ public:
{
// Little sanity check to make sure it's really a Throwable
ClassReferenceExp *boss = oldest->thrown;
- assert((*boss->value->elements)[4]->type->ty == Tclass); // Throwable.next
+ const int next = 4; // index of Throwable.next
+ assert((*boss->value->elements)[next]->type->ty == Tclass); // Throwable.next
ClassReferenceExp *collateral = newest->thrown;
if ( isAnErrorException(collateral->originalClass()) &&
!isAnErrorException(boss->originalClass()))
{
+ /* Find the index of the Error.bypassException field
+ */
+ int bypass = next + 1;
+ if ((*collateral->value->elements)[bypass]->type->ty == Tuns32)
+ bypass += 1; // skip over _refcount field
+ assert((*collateral->value->elements)[bypass]->type->ty == Tclass);
+
// The new exception bypass the existing chain
- assert((*collateral->value->elements)[5]->type->ty == Tclass);
- (*collateral->value->elements)[5] = boss;
+ (*collateral->value->elements)[bypass] = boss;
return newest;
}
- while ((*boss->value->elements)[4]->op == TOKclassreference)
+ while ((*boss->value->elements)[next]->op == TOKclassreference)
{
- boss = (ClassReferenceExp *)(*boss->value->elements)[4];
+ boss = (ClassReferenceExp *)(*boss->value->elements)[next];
}
- (*boss->value->elements)[4] = collateral;
+ (*boss->value->elements)[next] = collateral;
return oldest;
}