mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
The record layout of class types in D don't get any tail padding, so it is possible for the `classInstanceSize' to not be a multiple of the `classInstanceAlignment'. Rather than setting the instance alignment on the underlying RECORD_TYPE, instead give the type an alignment of 1, which will mark it as TYPE_PACKED. The value of `classInstanceAlignment' is instead applied to the DECL_ALIGN of both the static `init' symbol, and the stack allocated variable used when generating `new' for a `scope' class. PR d/117002 gcc/d/ChangeLog: * decl.cc (aggregate_initializer_decl): Set explicit decl alignment of class instance. * expr.cc (ExprVisitor::visit (NewExp *)): Likewise. * types.cc (TypeVisitor::visit (TypeClass *)): Mark the record type of classes as packed. gcc/testsuite/ChangeLog: * gdc.dg/torture/pr117002.d: New test.
The files in the dmd subdirectory are part of the front-end for the Digital Mars D compiler, hosted at https://github.com/dlang/dmd/. They cover the lexical analysis, parsing, and semantic analysis of the D Programming Language defined in the documents at https://dlang.org/. To report a problem or look up known issues with the dmd front-end, please visit the issue tracker at https://issues.dlang.org/. All changes to dmd should go through the upstream repository first, then merged back to GCC.