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
This commit is contained in:
Alexandre Oliva 2019-09-27 01:59:55 +00:00 committed by Alexandre Oliva
parent 09704140c7
commit 639a28ba6e
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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;