aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2019-03-09 19:29:29 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2019-03-09 19:29:29 +0000
commit9fa5d5de369171b7149827fbc784aedb27eb6b84 (patch)
tree062447e1859790cef12a54126fa7ba1bcecadd74 /gcc/d
parent4ea60a393eee13a0a7715b7c8134e2115195c7f7 (diff)
downloadgcc-9fa5d5de369171b7149827fbc784aedb27eb6b84.zip
gcc-9fa5d5de369171b7149827fbc784aedb27eb6b84.tar.gz
gcc-9fa5d5de369171b7149827fbc784aedb27eb6b84.tar.bz2
d: Fix ICE in get_frame_for_symbol
When generating code for a non-nested delegate literal, there is no context pointer required to pass to the function. 2019-03-09 Iain Buclaw <ibuclaw@gdcproject.org> gcc/d/ PR d/89041 * d-codegen.cc (get_frame_for_symbol): Delegate literals defined in global scope don't have a frame pointer. gcc/testsuite/ PR d/89041 * gdc.dg/pr89041.d: New test. From-SVN: r269533
Diffstat (limited to 'gcc/d')
-rw-r--r--gcc/d/ChangeLog6
-rw-r--r--gcc/d/d-codegen.cc15
2 files changed, 18 insertions, 3 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index 305b22e..4d9fb99 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-09 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/89041
+ * d-codegen.cc (get_frame_for_symbol): Delegate literals defined in
+ global scope don't have a frame pointer.
+
2019-03-01 Iain Buclaw <ibuclaw@gdcproject.org>
* d-builtins.cc (d_init_versions): Add CppRuntime_Gcc as predefined
diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc
index 58c8257..e8233b4 100644
--- a/gcc/d/d-codegen.cc
+++ b/gcc/d/d-codegen.cc
@@ -2172,7 +2172,16 @@ get_frame_for_symbol (Dsymbol *sym)
fdparent = (FuncDeclaration *) sym;
}
- gcc_assert (fdparent != NULL);
+ /* Not a nested function, there is no frame pointer to pass. */
+ if (fdparent == NULL)
+ {
+ /* Only delegate literals report as being nested, even if they are in
+ global scope. */
+ gcc_assert (fd && fd->isFuncLiteralDeclaration ());
+ return null_pointer_node;
+ }
+
+ gcc_assert (thisfd != NULL);
if (thisfd != fdparent)
{
@@ -2180,8 +2189,8 @@ get_frame_for_symbol (Dsymbol *sym)
if (!thisfd->vthis)
{
error_at (make_location_t (sym->loc),
- "is a nested function and cannot be accessed from %qs",
- thisfd->toChars ());
+ "%qs is a nested function and cannot be accessed from %qs",
+ fd->toPrettyChars (), thisfd->toPrettyChars ());
return null_pointer_node;
}