]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix internal error on pragma pack with discriminated record component
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 20 Aug 2024 08:34:45 +0000 (10:34 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 3 Sep 2024 08:16:42 +0000 (10:16 +0200)
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

index 398e01521a33c52edf7470419ae07207081f2f2b..655ba0b8a1051718f2c7e5f76aa0a1c9a1c7093a 100644 (file)
@@ -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;
        }
     }