From patchwork Fri Oct 11 09:08:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1175055 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-510728-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="Fx7c4l3a"; 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 46qMZt5HQGz9sCJ for ; Fri, 11 Oct 2019 20:09:09 +1100 (AEDT) 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=wkOahzz2Skm1N0ys LrXIAuLjOQ0L7LyikkrCZvv3++15Cw+fUM8ggE+9p0tEFaETNm+TW1RQfLKmqIXt vFu0CsuklvOj/VEvNDzmhKLCEPTFDs/qGIkLeTgnojCb3ZEUdr07KY6GgH+d8FNu 4GEDFr0NRGiuTIEqyrtzv8Nrk1o= 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=CmoKxgvWMZ1YS7ghvFFRdm rIycM=; b=Fx7c4l3axFCwY2UFEpCICet5q9o/A0lXq1/8eCs5cyS+cHGvRLbp2Y 03lImkJHPJ4iITM42EaiRtjCjjuMnADCZFqb0W0Nx9zUURW6danLcsO1m5ufVdWg mQ3ymmVMafNmv3glPmlNKxXq1d04AZA5nIPwypumSGXGCgHkdQE8M= Received: (qmail 62415 invoked by alias); 11 Oct 2019 09:09:02 -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 62407 invoked by uid 89); 11 Oct 2019 09:09:01 -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=Accept 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, 11 Oct 2019 09:09:00 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 877308139E for ; Fri, 11 Oct 2019 11:08:58 +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 XxV6dRO0Rryg for ; Fri, 11 Oct 2019 11:08:58 +0200 (CEST) Received: from polaris.localnet (unknown [IPv6:2a01:e35:8a16:3850:1a03:73ff:fe45:373a]) (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 634A481398 for ; Fri, 11 Oct 2019 11:08:58 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Accept size for record with oversized component clause Date: Fri, 11 Oct 2019 11:08:56 +0200 Message-ID: <8729710.nNBm8ti0Py@polaris> MIME-Version: 1.0 This makes the compiler accept again an exact size clause for a record type that contains both a component subject to a representation clause that gives it a size greater than its nominal size and another component that is aliased. Tested on x86_64-suse-linux, applied on the mainline. 2019-10-11 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_field): Adjust again the packing for a field without strict alignment and with an oversized clause. 2019-10-11 Eric Botcazou * gnat.dg/specs/size_clause4.ads: New test. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 276866) +++ gcc-interface/decl.c (working copy) @@ -7229,10 +7229,17 @@ gnat_to_gnu_field (Entity_Id gnat_field, && INTEGRAL_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_field_type)))) gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type)); + orig_field_type = gnu_field_type; gnu_field_type = make_type_from_size (gnu_field_type, gnu_size, Has_Biased_Representation (gnat_field)); + /* If the type has been extended, we may need to cap the alignment. */ + if (!needs_strict_alignment + && gnu_field_type != orig_field_type + && tree_int_cst_lt (TYPE_SIZE (orig_field_type), gnu_size)) + packed = adjust_packed (gnu_field_type, gnu_record_type, packed); + orig_field_type = gnu_field_type; gnu_field_type = maybe_pad_type (gnu_field_type, gnu_size, 0, gnat_field, false, false, definition, true);