d: Force TYPE_MODE of classes and non-POD structs as BLKmode
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 22 Dec 2020 08:47:22 +0000 (09:47 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Wed, 23 Dec 2020 16:32:52 +0000 (17:32 +0100)
commitfeb3c40c8ee043cc893410c9985926439292caee
treef01493c8c69af1fc5536d5b08c1b3f38d052e874
parent16929214fd139c9d092f9bfbd9d8287d5903f593
d: Force TYPE_MODE of classes and non-POD structs as BLKmode

Without this being forced, the optimizer could still make decisions that
require objects of the non-POD types to need a temporary, which would
result in an ICE during the expand to RTL passes.

gcc/d/ChangeLog:

PR d/98427
* types.cc (TypeVisitor::visit (TypeStruct *)): Set TYPE_MODE of all
non-trivial types as BLKmode.
(TypeVisitor::visit (TypeClass *)): Likewise.

gcc/testsuite/ChangeLog:

PR d/98427
* gdc.dg/pr98427.d: New test.
gcc/d/types.cc
gcc/testsuite/gdc.dg/pr98427.d [new file with mode: 0644]