d: Fix ICE in assign_temp, at function.c:984 (PR94777)
authorIain Buclaw <ibuclaw@gdcproject.org>
Sun, 26 Apr 2020 21:39:32 +0000 (23:39 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Mon, 27 Apr 2020 00:47:26 +0000 (02:47 +0200)
commit2370bdbb0b29b14401d8508d846c0e01c64d82fc
tree43016d247bb7f8fa7a5b397e862e30f29ef07456
parentf82e3a12955e484b4da7fcca93655a2a2e785e5b
d: Fix ICE in assign_temp, at function.c:984 (PR94777)

Named arguments were being passed around by invisible reference, just
not variadic arguments.  There is a need to de-duplicate the routines
that handle declaration/parameter promotion and reference checking.
However for now, the parameter helper functions have just been renamed
to parameter_reference_p and parameter_type, to make it more clear that
it is the Parameter equivalent to declaration_reference_p and
declaration_type.

On writing the tests, a forward-reference bug was discovered on x86_64
during va_list type semantic.  This was due to fields not having their
parent set-up correctly.

gcc/d/ChangeLog:

PR d/94777
* d-builtins.cc (build_frontend_type): Set parent for generated
fields of built-in types.
* d-codegen.cc (argument_reference_p): Rename to ...
(parameter_reference_p): ... this.
(type_passed_as): Rename to ...
(parameter_type): ... this.  Make TREE_ADDRESSABLE types restrict.
(d_build_call): Move handling of non-POD types here from ...
* d-convert.cc (convert_for_argument): ... here.
* d-tree.h (argument_reference_p): Rename declaration to ...
(parameter_reference_p): ... this.
(type_passed_as): Rename declaration to ...
(parameter_type): ... this.
* types.cc (TypeVisitor::visit (TypeFunction *)): Update caller.

gcc/testsuite/ChangeLog:

PR d/94777
* gdc.dg/pr94777a.d: New test.
* gdc.dg/pr94777b.d: New test.
gcc/d/ChangeLog
gcc/d/d-builtins.cc
gcc/d/d-codegen.cc
gcc/d/d-convert.cc
gcc/d/d-tree.h
gcc/d/types.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gdc.dg/pr94777a.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/pr94777b.d [new file with mode: 0644]