d: Use memset to fill alignment holes with zeroes.
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 31 Mar 2020 16:18:32 +0000 (18:18 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Tue, 31 Mar 2020 17:03:04 +0000 (19:03 +0200)
commite8e0acbaa38ed57b4cbf9e60556f78a059ba2c0b
tree2b0a1176388e6ba4d442efc370ed2e919ce95eb9
parentf14b41d27124601284347a10d496362c8b4b8e1c
d: Use memset to fill alignment holes with zeroes.

This patch removes the manual insertion of padding for fields in
constructed struct literals, and instead uses memset() on the
declaration being initialized.

When compiling optimized builds, the intent is usually missed, and
alignment holes end up with non-zero values in them anyway.

gcc/d/ChangeLog:

PR d/94424
* d-codegen.cc (build_alignment_field): Remove.
(build_struct_literal): Don't insert alignment padding.
* expr.cc (ExprVisitor::visit (AssignExp *)): Call memset before
assigning struct literals.

gcc/testsuite/ChangeLog:

PR d/94424
* gdc.dg/pr94424.d: New test.
gcc/d/ChangeLog
gcc/d/d-codegen.cc
gcc/d/expr.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gdc.dg/pr94424.d [new file with mode: 0644]