From: Iain Buclaw Date: Sun, 31 Mar 2019 14:34:41 +0000 (+0000) Subject: d: Fix run-time SIGSEGV reading ModuleInfo.flags() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1605fb3ed04c6958c292deec72e120f787e4843d;p=gcc.git d: Fix run-time SIGSEGV reading ModuleInfo.flags() The current forced alignment is not necessary, and is problematic on targets that have strict alignment rules. gcc/d/ChangeLog: 2019-03-31 Iain Buclaw PR d/88462 * modules.cc (layout_moduleinfo_fields): Properly align ModuleInfo, instead of forcing alignment to be 1. From-SVN: r270043 --- diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 39df9b8aac0..bb2a2370467 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,9 @@ +2019-03-31 Iain Buclaw + + PR d/88462 + * modules.cc (layout_moduleinfo_fields): Properly align ModuleInfo, + instead of forcing alignment to be 1. + 2019-03-21 Iain Buclaw PR d/89017 diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc index a1fc534c3b6..e9bd44115f9 100644 --- a/gcc/d/modules.cc +++ b/gcc/d/modules.cc @@ -534,7 +534,9 @@ layout_moduleinfo_fields (Module *decl, tree type) layout_moduleinfo_field (make_array_type (Type::tchar, namelen), type, offset); - finish_aggregate_type (offset, 1, type, NULL); + size_t alignsize = MAX (TYPE_ALIGN_UNIT (type), + TYPE_ALIGN_UNIT (ptr_type_node)); + finish_aggregate_type (offset, alignsize, type, NULL); return type; }