From 9ba7262c8de0a96e85cc1ad05e2c3666228c74e8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 20 Aug 2024 10:34:45 +0200 Subject: ada: Fix internal error on pragma pack with discriminated record component When updating the size after making a packable type in gnat_to_gnu_field, we fail to clear it again when it is not constant. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_field): Clear again gnu_size after updating it if it is not constant. --- gcc/ada/gcc-interface/decl.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/ada') diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 398e015..655ba0b 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -7686,6 +7686,8 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, gnu_field_type = gnu_packable_type; if (!gnu_size) gnu_size = rm_size (gnu_field_type); + if (TREE_CODE (gnu_size) != INTEGER_CST) + gnu_size = NULL_TREE; } } -- cgit v1.1