From 470f467fa6f2a0145850c3fd6369c9cb0875fc9e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 16 Jan 2013 20:08:10 -0500 Subject: [PATCH 1/1] Fix: alignment of compound types containing array field The "alignment" field of the array declaration is used by compound types containing an array field to calculate the alignment needed for the compound types. Reported-by: Simon Marchi Signed-off-by: Mathieu Desnoyers --- types/array.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/array.c b/types/array.c index 3a92ef76..49421082 100644 --- a/types/array.c +++ b/types/array.c @@ -84,8 +84,7 @@ struct declaration_array * array_declaration->elem = elem_declaration; array_declaration->scope = new_declaration_scope(parent_scope); declaration->id = CTF_TYPE_ARRAY; - /* No need to align the array, the first element will align itself */ - declaration->alignment = 1; + declaration->alignment = elem_declaration->alignment; declaration->declaration_free = _array_declaration_free; declaration->definition_new = _array_definition_new; declaration->definition_free = _array_definition_free; -- 2.34.1