[PR,d/88462] Committed fix for run-time SIGSEGV in ModuleInfo.flags()

Message ID CABOHX+dZ0Gde2rt=7LF7KVqEXgu+ctABbM+p7Sn-e41yY+Xjog@mail.gmail.com
State New
Headers show
Series
  • [PR,d/88462] Committed fix for run-time SIGSEGV in ModuleInfo.flags()
Related show

Commit Message

Iain Buclaw March 31, 2019, 2:35 p.m.
Hi,

Patch fixes problems accessing ModuleInfo on SPARC.  The current
forced alignment is not at all necessary.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to trunk as r270043.

-- 
Iain
---
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.

---

Patch

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;
 }