aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/modules.cc
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2019-03-31 14:34:41 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2019-03-31 14:34:41 +0000
commit1605fb3ed04c6958c292deec72e120f787e4843d (patch)
tree4c2a01b87b27baf9d93570abcd11a47ec78a3266 /gcc/d/modules.cc
parent16216c7fbef2ee35e673a7cfef47bc075f791e0c (diff)
downloadgcc-1605fb3ed04c6958c292deec72e120f787e4843d.zip
gcc-1605fb3ed04c6958c292deec72e120f787e4843d.tar.gz
gcc-1605fb3ed04c6958c292deec72e120f787e4843d.tar.bz2
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 <ibuclaw@gdcproject.org> PR d/88462 * modules.cc (layout_moduleinfo_fields): Properly align ModuleInfo, instead of forcing alignment to be 1. From-SVN: r270043
Diffstat (limited to 'gcc/d/modules.cc')
-rw-r--r--gcc/d/modules.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc
index a1fc534..e9bd441 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;
}