Commit 20faffe7 by Eric Botcazou Committed by Eric Botcazou

trans.c (Attribute_to_gnu): Strip conversions between original and packable…

trans.c (Attribute_to_gnu): Strip conversions between original and packable version of types from the...

	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Strip
	conversions between original and packable version of types from
	the expression.

From-SVN: r151757
parent 721641c4
2009-09-16 Eric Botcazou <ebotcazou@adacore.com> 2009-09-16 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Size>: Strip
conversions between original and packable version of types from
the expression.
2009-09-16 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_field): Add DEBUG_INFO_P parameter. * gcc-interface/decl.c (gnat_to_gnu_field): Add DEBUG_INFO_P parameter.
If a padding type was made for the field, declare it. If a padding type was made for the field, declare it.
(components_to_record): Add DEBUG_INFO_P parameter. Adjust call (components_to_record): Add DEBUG_INFO_P parameter. Adjust call
......
...@@ -1279,9 +1279,16 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1279,9 +1279,16 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
case Attr_Max_Size_In_Storage_Elements: case Attr_Max_Size_In_Storage_Elements:
gnu_expr = gnu_prefix; gnu_expr = gnu_prefix;
/* Remove NOPs from GNU_EXPR and conversions from GNU_PREFIX. /* Remove NOPs and conversions between original and packable version
We only use GNU_EXPR to see if a COMPONENT_REF was involved. */ from GNU_EXPR, and conversions from GNU_PREFIX. We use GNU_EXPR
while (TREE_CODE (gnu_expr) == NOP_EXPR) to see if a COMPONENT_REF was involved. */
while (TREE_CODE (gnu_expr) == NOP_EXPR
|| (TREE_CODE (gnu_expr) == VIEW_CONVERT_EXPR
&& TREE_CODE (TREE_TYPE (gnu_expr)) == RECORD_TYPE
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))
== RECORD_TYPE
&& TYPE_NAME (TREE_TYPE (gnu_expr))
== TYPE_NAME (TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))))
gnu_expr = TREE_OPERAND (gnu_expr, 0); gnu_expr = TREE_OPERAND (gnu_expr, 0);
gnu_prefix = remove_conversions (gnu_prefix, true); gnu_prefix = remove_conversions (gnu_prefix, true);
......
2009-09-16 Eric Botcazou <ebotcazou@adacore.com> 2009-09-16 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/alignment9.adb: New test.
2009-09-16 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/discr20.ad[sb]: New test. * gnat.dg/discr20.ad[sb]: New test.
2009-09-16 Richard Guenther <rguenther@suse.de> 2009-09-16 Richard Guenther <rguenther@suse.de>
......
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure Alignment9 is
type Kind is (Small, Large);
for Kind'Size use 8;
type Header is
record
K : Kind;
I : Integer;
end record;
for Header use
record
K at 4 range 0..7;
I at 0 range 0..31;
end record;
for Header'Size use 5*8;
for Header'Alignment use 1;
H : Header;
begin
if H'Size /= 40 then
raise Program_Error;
end if;
end;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment