aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2019-09-27 01:59:55 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2019-09-27 01:59:55 +0000
commit639a28ba6e0e5807ae062475f35cc6895e32ef17 (patch)
tree8357cec521fab8b93a5e2ebb697ae8dcd3877b67
parent09704140c7f3e4341d66a32e40359c4d146a4350 (diff)
downloadgcc-639a28ba6e0e5807ae062475f35cc6895e32ef17.zip
gcc-639a28ba6e0e5807ae062475f35cc6895e32ef17.tar.gz
gcc-639a28ba6e0e5807ae062475f35cc6895e32ef17.tar.bz2
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
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/decl.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a5f3843..8e5a19b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-26 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc-interface/decl.c (components_to_record): Set
+ DECL_SIZE_UNIT for zero-sized fields.
+
2019-09-26 Arnaud Charlet <charlet@adacore.com>
* 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 67b938e..77c6c9f 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;