Fix: alignment of compound types containing array field
[babeltrace.git] / types / array.c
index 047adac21902c7d7f438fc14a1e55099181280f1..494210827ff80ab301479b6aa4537d49c24684b7 100644 (file)
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  */
 
 #include <babeltrace/compiler.h>
@@ -76,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.025191 seconds and 4 git commands to generate.