From patchwork Fri Sep 27 01:41:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1168205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-509681-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="EqFOGfbR"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46fZJy2WkFz9sNx for ; Fri, 27 Sep 2019 11:41:32 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=x1CWioJ/I8+VI1HP 9pPClruI6BZv3uS3U6eytMmx5yxOAk5SLSgHL/o5GJ0DIzBxT6ldnd4h+xOw6ugX IjXTZDfdTAYXwK9VpacccyenHfO5CTEOEuHc9JPrjfu6pR8QCLor7sS0JarWFZ1p YnsAWneqtj3lf0quKbl1Ygi2SoE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=QhWpFO8EwX0gsC6i61karv QxO3k=; b=EqFOGfbRKucCOQ8X1ZVA6huHsp/Phc41q0WVEGlX5rxoCjRW/nFNbl oLdSKNeLHa1B1gUG3IN7VTeNcEi9fEhrtvSNBtxnl5DYypH2zzdRM64p0zqTupvu vw8bCdvw5b+AFflCi6zZOa5Bqf2GV8AORKhFSh3D9Q5s2LAXRmgdA= Received: (qmail 30137 invoked by alias); 27 Sep 2019 01:41:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30128 invoked by uid 89); 27 Sep 2019 01:41:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=FYI, fyi, sk:bitsize, decl_size_unit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Sep 2019 01:41:22 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D91DD117B3B; Thu, 26 Sep 2019 21:41:20 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 7g1il3h8b49R; Thu, 26 Sep 2019 21:41:20 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 9A68D117B34; Thu, 26 Sep 2019 21:41:20 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id x8R1f1kA049623 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 26 Sep 2019 22:41:02 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: [FYI] [Ada] set DECL_SIZE_UNIT for zero-sized fields Date: Thu, 26 Sep 2019 22:41:01 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 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. Regstrapped on x86_64-linux-gnu. I'm checking this in. for gcc/ada/ChangeLog * gcc-interface/decl.c (components_to_record): Set DECL_SIZE_UNIT for zero-sized fields. --- gcc/ada/gcc-interface/decl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 67b938ee7eef0..77c6c9f12e76c 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;