d: Fix internal compiler error: in add_expr, at tree.c:7794
gcc/d/ChangeLog: PR d/91238 * d-codegen.cc (build_address): If taking the address of a CALL_EXPR, wrap it in a TARGET_EXPR. gcc/testsuite/ChangeLog: PR d/91238 * gdc.dg/pr91238.d: New test. From-SVN: r274253
This commit is contained in:
parent
77eb117f58
commit
884efbd523
4 changed files with 34 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
2019-08-10 Iain Buclaw <ibuclaw@gdcproject.org>
|
||||
|
||||
PR d/91238
|
||||
* d-codegen.cc (build_address): If taking the address of a CALL_EXPR,
|
||||
wrap it in a TARGET_EXPR.
|
||||
|
||||
2019-08-10 Iain Buclaw <ibuclaw@gdcproject.org>
|
||||
|
||||
PR d/90893
|
||||
|
|
|
@ -651,9 +651,11 @@ build_address (tree exp)
|
|||
if (TREE_CODE (exp) == CONST_DECL)
|
||||
exp = DECL_INITIAL (exp);
|
||||
|
||||
/* Some expression lowering may request an address of a compile-time constant.
|
||||
Make sure it is assigned to a location we can reference. */
|
||||
if (CONSTANT_CLASS_P (exp) && TREE_CODE (exp) != STRING_CST)
|
||||
/* Some expression lowering may request an address of a compile-time constant,
|
||||
or other non-lvalue expression. Make sure it is assigned to a location we
|
||||
can reference. */
|
||||
if ((CONSTANT_CLASS_P (exp) && TREE_CODE (exp) != STRING_CST)
|
||||
|| TREE_CODE (exp) == CALL_EXPR)
|
||||
exp = force_target_expr (exp);
|
||||
|
||||
d_mark_addressable (exp);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2019-08-10 Iain Buclaw <ibuclaw@gdcproject.org>
|
||||
|
||||
PR d/91238
|
||||
* gdc.dg/pr91238.d: New test.
|
||||
|
||||
2019-08-10 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* c-c++-common/gomp/declare-target-2.c: Don't expect error for
|
||||
|
|
18
gcc/testsuite/gdc.dg/pr91238.d
Normal file
18
gcc/testsuite/gdc.dg/pr91238.d
Normal file
|
@ -0,0 +1,18 @@
|
|||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91238
|
||||
// { dg-do compile }
|
||||
|
||||
alias T = const(char)*;
|
||||
|
||||
T name()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void collect(ref T)
|
||||
{
|
||||
}
|
||||
|
||||
void configure(T[T] targets)
|
||||
{
|
||||
collect(targets[name]);
|
||||
}
|
Loading…
Add table
Reference in a new issue