+2008-04-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * decl.c (is_variable_size): Do not unconditionally return false
+ on non-strict alignment platforms.
+
2008-04-06 Eric Botcazou <ebotcazou@adacore.com>
* decl.c (rest_of_type_decl_compilation_no_defer): New local function
{
tree field;
- /* We need not be concerned about this at all if we don't have
- strict alignment. */
- if (!STRICT_ALIGNMENT)
- return false;
- else if (!TREE_CONSTANT (TYPE_SIZE (type)))
+ if (!TREE_CONSTANT (TYPE_SIZE (type)))
return true;
- else if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type)
- && !TREE_CONSTANT (DECL_SIZE (TYPE_FIELDS (type))))
+
+ if (TREE_CODE (type) == RECORD_TYPE
+ && TYPE_IS_PADDING_P (type)
+ && !TREE_CONSTANT (DECL_SIZE (TYPE_FIELDS (type))))
return true;
- else if (TREE_CODE (type) != RECORD_TYPE
- && TREE_CODE (type) != UNION_TYPE
- && TREE_CODE (type) != QUAL_UNION_TYPE)
+
+ if (TREE_CODE (type) != RECORD_TYPE
+ && TREE_CODE (type) != UNION_TYPE
+ && TREE_CODE (type) != QUAL_UNION_TYPE)
return false;
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
--- /dev/null
+-- { dg-do compile }
+
+procedure Pack5 is
+
+ type Kind is (v1, v2, v3);
+
+ type Error (k : Kind := Kind'First) is record
+ case k is
+ when v1 =>
+ null;
+ when v2 =>
+ null;
+ when Others =>
+ B : Boolean;
+ end case;
+ end record;
+ pragma Pack (Error);
+ for Error'Size use 16;
+
+ No_Error: constant Error := (k => v2);
+
+ type R (B : Boolean) is record
+ E : Error;
+ end record;
+ pragma Pack(R);
+ type Ptr is access R;
+
+ C : Ptr := new R (True);
+
+begin
+ C.E := No_Error;
+end;