diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2009-05-23 10:51:18 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2009-05-23 10:51:18 +0000 |
commit | 03049a4e4057caafa15970e41be553a1043b643c (patch) | |
tree | 154f93a74c13b6793c95831abe456ce6dd5f9dec /gcc | |
parent | aae8570a44715ff724f31c3fc2442e5f69c929a7 (diff) | |
download | gcc-03049a4e4057caafa15970e41be553a1043b643c.zip gcc-03049a4e4057caafa15970e41be553a1043b643c.tar.gz gcc-03049a4e4057caafa15970e41be553a1043b643c.tar.bz2 |
decl.c (set_rm_size): Bypass the check for packed array types.
* gcc-interface/decl.c (set_rm_size): Bypass the check for packed array
types.
From-SVN: r147819
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/rep_clause3.ads | 36 |
4 files changed, 55 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1484a6a..8c963db 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2009-05-23 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/decl.c (set_rm_size): Bypass the check for packed array + types. + +2009-05-23 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Do not modify the original type because of the alignment when there is an address clause. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index ca48c5a..e6f1d3a 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -7391,11 +7391,18 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity) if (CONTAINS_PLACEHOLDER_P (old_size)) old_size = max_size (old_size, true); - /* If the size of the object is a constant, the new size must not be - smaller (the front-end checks this for scalar types). */ + /* If the size of the object is a constant, the new size must not be smaller + (the front-end has verified this for scalar and packed array types). */ if (TREE_CODE (old_size) != INTEGER_CST || TREE_OVERFLOW (old_size) - || (AGGREGATE_TYPE_P (gnu_type) && tree_int_cst_lt (size, old_size))) + || (AGGREGATE_TYPE_P (gnu_type) + && !(TREE_CODE (gnu_type) == ARRAY_TYPE + && TYPE_PACKED_ARRAY_TYPE_P (gnu_type)) + && !(TREE_CODE (gnu_type) == RECORD_TYPE + && TYPE_IS_PADDING_P (gnu_type) + && TREE_CODE (TREE_TYPE (TYPE_FIELDS (gnu_type))) == ARRAY_TYPE + && TYPE_PACKED_ARRAY_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_type)))) + && tree_int_cst_lt (size, old_size))) { if (Present (gnat_attr_node)) post_error_ne_tree diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1d8379a..6fc23ed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2009-05-23 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/specs/rep_clause3.ads: New test. + +2009-05-23 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/addr6.adb: New test. 2009-05-22 Mark Mitchell <mark@codesourcery.com> diff --git a/gcc/testsuite/gnat.dg/specs/rep_clause3.ads b/gcc/testsuite/gnat.dg/specs/rep_clause3.ads new file mode 100644 index 0000000..438c604 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/rep_clause3.ads @@ -0,0 +1,36 @@ +package Rep_Clause3 is + + type Record1 is + record + Page_Handle : Integer range 0 .. 255; + Page_Owner : Integer range 0 .. 15; + end record; + for Record1 use + record + Page_Handle at 0 range 0 .. 15; + Page_Owner at 0 range 16 .. 19; + end record; + for Record1'Size use 20; + + type Range_A is range 1 .. 7; + for Range_A'Size use 16; + + type Array_Type is array (Range_A) of Record1; + pragma Pack (Array_Type); + for Array_Type'Size use 7 * 20; +-- for array_Type'alignment use 1; + + type Record2 is + record + Page_Tree_Index : Range_A; + Page_Tree : Array_Type; + end record; + + for Record2 use + record + Page_Tree_Index at 0 range 0 .. 15; + Page_Tree at 0 range 16 .. 15 + (7 * 20); + end record; + for Record2'Size use 16 + (7 * 20); + +end Rep_Clause3; |