[Bug d/94424] [D] Alignment holes can in structs can still end up with non-zero data
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 31 17:05:07 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94424
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:e8e0acbaa38ed57b4cbf9e60556f78a059ba2c0b
commit r10-7482-ge8e0acbaa38ed57b4cbf9e60556f78a059ba2c0b
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Tue Mar 31 18:18:32 2020 +0200
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.
More information about the Gcc-bugs
mailing list