d: Fix small struct literals that have non-deterministic hash values
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 25 Aug 2020 09:05:57 +0000 (11:05 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Wed, 26 Aug 2020 08:03:55 +0000 (10:03 +0200)
commit1db88844a22f75b13ced224415f645680784d354
treea4485d214e8b889e877596535d9a7d0de971b27b
parent312ad889e99ff9458c01518325775e75ab57f272
d: Fix small struct literals that have non-deterministic hash values

Same issue as the initial commit that addressed PR96153, only this time to fix
it also for structs that are not returned in memory.  Tests have been added
that triggered an assertion on x86_64, however the original test was failing
on SPARC 64-bit targets.

gcc/d/ChangeLog:

PR d/96153
* d-codegen.cc (build_address): Create a temporary for CALL_EXPRs
returning trivial aggregates, pre-filling it with zeroes.
(build_memset_call): Use build_zero_cst if setting the entire object.

gcc/testsuite/ChangeLog:

PR d/96153
* gdc.dg/pr96153.d: Add new tests.
gcc/d/d-codegen.cc
gcc/testsuite/gdc.dg/pr96153.d