aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-11-18 22:47:05 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-12-02 16:26:31 +0000
commit31a6895f4c20a0cadfd28be8de75258ba77212f7 (patch)
treef528bfb9d4cc8ff764e4914087545eab1316d0b6 /gcc
parent5a11ffadf58a3668655e08f610281ac5567b4d93 (diff)
downloadgcc-31a6895f4c20a0cadfd28be8de75258ba77212f7.zip
gcc-31a6895f4c20a0cadfd28be8de75258ba77212f7.tar.gz
gcc-31a6895f4c20a0cadfd28be8de75258ba77212f7.tar.bz2
[Ada] Do not back-annotate maximum size for limited types
gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Do not back-annotate a maximum size for the Esize of limited record and concurrent types.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gcc-interface/decl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index f0c17fc..93b6eb5 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -4426,8 +4426,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
tree size = TYPE_SIZE (gnu_type);
/* If the size is self-referential, annotate the maximum value
- after saturating it, if need be, to avoid a No_Uint value. */
- if (CONTAINS_PLACEHOLDER_P (size))
+ after saturating it, if need be, to avoid a No_Uint value.
+ But do not do it for cases where Analyze_Object_Declaration
+ in Sem_Ch3 would build a default subtype for objects. */
+ if (CONTAINS_PLACEHOLDER_P (size)
+ && !Is_Limited_Record (gnat_entity)
+ && !Is_Concurrent_Type (gnat_entity))
{
const unsigned int align
= UI_To_Int (Alignment (gnat_entity)) * BITS_PER_UNIT;