From 639a28ba6e0e5807ae062475f35cc6895e32ef17 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Fri, 27 Sep 2019 01:59:55 +0000 Subject: [PATCH] set DECL_SIZE_UNIT for zero-sized fields Zero-sized fields do not get processed by finish_record_type: they're removed from the field list before and reinserted after, so their DECL_SIZE_UNIT remains unset, causing the translation of assignment statements with use_memset_p, in quite unusual circumstances, to use a NULL_TREE as the memset length. This patch sets DECL_SIZE_UNIT for the zero-sized fields, that don't go through language-independent layout, in language-specific layout. for gcc/ada/ChangeLog * gcc-interface/decl.c (components_to_record): Set DECL_SIZE_UNIT for zero-sized fields. From-SVN: r276173 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/decl.c | 1 + 2 files changed, 6 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a5f3843ca00..8e5a19bc9e8 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-09-26 Alexandre Oliva + + * gcc-interface/decl.c (components_to_record): Set + DECL_SIZE_UNIT for zero-sized fields. + 2019-09-26 Arnaud Charlet * osint.adb (OS_Time_To_GNAT_Time): Remove dependency on To_C/To_Ada diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 67b938ee7ee..77c6c9f12e7 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -7928,6 +7928,7 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type, if (DECL_SIZE (gnu_field) && integer_zerop (DECL_SIZE (gnu_field))) { + DECL_SIZE_UNIT (gnu_field) = size_zero_node; DECL_FIELD_OFFSET (gnu_field) = size_zero_node; SET_DECL_OFFSET_ALIGN (gnu_field, BIGGEST_ALIGNMENT); DECL_FIELD_BIT_OFFSET (gnu_field) = bitsize_zero_node; -- 2.30.2