From patchwork Mon Jun 1 08:02:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 478803 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 1A01A1412DD for ; Mon, 1 Jun 2015 18:04:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=XFcZLuDy; dkim-atps=neutral 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=OtiUmNQxAU0MWgmY Z4g825H/6+7zlyz2MxdG2D/PwtnSFB3avpNYKgh3kjaFqYrnXtXNTfBb6NgOBAPC +jn1eo7doPQO1R9RwzARcwfdTCktbMdpKs3W5ynA/VL5wDMQRRddFj7kL4drTy2M 7c00ST+Zx09TgsyuwSvhzgaCx9Y= 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=ABrfRkIY/vXe4L4dIYovpv WCP+M=; b=XFcZLuDy88Gsj+xxHC0AVVS3vN18CPt+A++U0Rxt0ilMXT9xIpP7jM fbAT27AVo4mLMhWTaN/dAmtXMfI5ej7A7PSfaFCAE+i/BvncZ+XL8nThXkhGyDGD GbdJW+kzCqmjJt1f7UFT6ncUe+jQUoZjRFOrEYQui/aIRMtS9pkXE= Received: (qmail 4082 invoked by alias); 1 Jun 2015 08:04:29 -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 4069 invoked by uid 89); 1 Jun 2015 08:04:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 01 Jun 2015 08:04:27 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 20BF22852C63 for ; Mon, 1 Jun 2015 10:04:24 +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 DHk80OGWWDl0 for ; Mon, 1 Jun 2015 10:04:24 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id F3D932852C5E for ; Mon, 1 Jun 2015 10:04:23 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix internal alignment issue Date: Mon, 01 Jun 2015 10:02:26 +0200 Message-ID: <1510481.GFra1aRlpr@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 This fixes an old alignment issue with the _Parent field created by gigi for extension of tagged types: when the record type has a representation clause, the field is not correctly aligned, which leads to further issues downhill. Tested on x86_64-suse-linux, applied on the mainline. 2015-06-01 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : If the record has a parent field and a representation clause, make sure that it is properly aligned. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 223912) +++ gcc-interface/decl.c (working copy) @@ -3019,6 +3019,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entit else gnu_parent = gnat_to_gnu_type (gnat_parent); + /* The parent field needs strict alignment so, if it is to + be created with a component clause below, then we need + to apply the same adjustment as in gnat_to_gnu_field. */ + if (has_rep && TYPE_ALIGN (gnu_type) < TYPE_ALIGN (gnu_parent)) + TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_parent); + /* Finally we fix up both kinds of twisted COMPONENT_REF we have initially built. The discriminants must reference the fields of the parent subtype and not those of its base type for the