From patchwork Fri Aug 30 14:26:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1155945 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-508036-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="me2D9gNt"; 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 46Khcq3x78z9sN4 for ; Sat, 31 Aug 2019 00:26:49 +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=sE4UDGkHbQG7TQLi NMiiwGR/MZkT6ygivctwrS8DlzlVGc0NGHDNp3LzZwQrDGZ32axW6Y7CDmoVm7Cu ceb4NRa0+8TOgF1Mou0QKfTpfsvd1eBLBwrO1a290a2QOQuELcntMpLN4JBnlRur kioOPvBrLaqqY0zLw6POe80Z/FQ= 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=ISv7JPyvmzVCPYEuRP7pB7 qq8bQ=; b=me2D9gNtCqul8XMlxrz2yKV/l0LcAmogQKCswlV3vEfsNqxW77NJ2L UjY44QWt315IT45EQ6TqGpJPoaNl5baPKqTuQaEQ1LodDf4ODqZLpVSLZqpMSkqp bPR0V+ldcNH57hGh4Bq51NBVOM6TW5wCnUkP99XRkJR3oWeSpnDis= Received: (qmail 69422 invoked by alias); 30 Aug 2019 14:26:41 -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 69374 invoked by uid 89); 30 Aug 2019 14:26:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=COMPONENT_REF, HX-Languages-Length:969, component_ref X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Aug 2019 14:26:40 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id AF1E18138F for ; Fri, 30 Aug 2019 16:26:38 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hAR1aDwAX6KH for ; Fri, 30 Aug 2019 16:26:38 +0200 (CEST) Received: from arcturus.home (unknown [IPv6:2a01:e35:8a16:3850:36e6:d7ff:fe66:317b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 8ECBB8138C for ; Fri, 30 Aug 2019 16:26:38 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Add assertion for Size attribute et al. Date: Fri, 30 Aug 2019 16:26:48 +0200 Message-ID: <1658397.meEJfPj24F@arcturus.home> MIME-Version: 1.0 The type to which, or the type of the object to which, it is applied must be frozen when the Size attribute, or a variant thereof, is processed. Tested on x86_64-suse-linux, applied on the mainline. 2019-08-30 Eric Botcazou * gcc-interface/trans.c (Attribute_to_gnu) : Add assertion. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 275174) +++ gcc-interface/trans.c (working copy) @@ -2351,6 +2351,9 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_res gnu_type = TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_type))); } + /* The type must be frozen at this point. */ + gcc_assert (COMPLETE_TYPE_P (gnu_type)); + /* If we're looking for the size of a field, return the field size. */ if (TREE_CODE (gnu_prefix) == COMPONENT_REF) gnu_result = DECL_SIZE (TREE_OPERAND (gnu_prefix, 1));