diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-09-12 12:36:30 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2020-09-12 12:37:47 +0200 |
commit | 4965be0b3388557643114c1ec20bd206f0bda1df (patch) | |
tree | 6a7a512bb146d15d24acc1c21c82bb69d89cfb4a /gcc/ada | |
parent | ac35c090821f92f41e83d1688eaf2e2b4946afb1 (diff) | |
download | gcc-4965be0b3388557643114c1ec20bd206f0bda1df.zip gcc-4965be0b3388557643114c1ec20bd206f0bda1df.tar.gz gcc-4965be0b3388557643114c1ec20bd206f0bda1df.tar.bz2 |
Accept absolute address clause for array of UNC nominal subtype
This changes the compiler to accept again absolute address clause for
aliased array of unconstrained nominal subtype, instead of erroring
out in this case.
gcc/ada/ChangeLog:
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Only give
a warning for the overlay of an aliased array with an unconstrained
nominal subtype if the address is absolute.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 2b7392c..d19f5aa 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1245,6 +1245,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if (TREE_CODE (gnu_address) == POINTER_PLUS_EXPR && TREE_OPERAND (gnu_address, 1) == off) gnu_address = TREE_OPERAND (gnu_address, 0); + /* This is the pattern built for an overaligned object. */ else if (TREE_CODE (gnu_address) == POINTER_PLUS_EXPR && TREE_CODE (TREE_OPERAND (gnu_address, 1)) @@ -1255,6 +1256,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) = build2 (POINTER_PLUS_EXPR, gnu_type, TREE_OPERAND (gnu_address, 0), TREE_OPERAND (TREE_OPERAND (gnu_address, 1), 0)); + + /* We make an exception for an absolute address but we warn + that there is a descriptor at the start of the object. */ + else if (TREE_CODE (gnu_address) == INTEGER_CST) + { + post_error_ne ("??aliased object& with unconstrained " + "array nominal subtype", gnat_clause, + gnat_entity); + post_error ("\\starts with a descriptor whose size is " + "given by ''Descriptor_Size", gnat_clause); + } + else { post_error_ne ("aliased object& with unconstrained array " |