Fix: alignment of compound types containing array field
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 17 Jan 2013 01:08:10 +0000 (20:08 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 17 Jan 2013 01:08:10 +0000 (20:08 -0500)
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 <simon.marchi@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
types/array.c

index 3a92ef769fff5684680b616c0391678226709ecc..494210827ff80ab301479b6aa4537d49c24684b7 100644 (file)
@@ -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;
This page took 0.032997 seconds and 4 git commands to generate.