From patchwork Wed Mar 6 17:59:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 225565 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]) by ozlabs.org (Postfix) with SMTP id 920BE2C0393 for ; Thu, 7 Mar 2013 05:02:18 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1363197739; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=4JuUD1iy2uOUfkjeWZ4PyOTmirg=; b=Zqk0JTRRN5zt+Sm 3VBBKCtDp5wae3u3VYIozseoTy8vOc3Hy4rjBybcsUGmjJ0z49vmPsqKJG6hznys B+v+DtfgRX05QaoSVakJDs29/N5ExH9cX78HpKyQK7vb++eGtPbhFcqkAMQHsu0Q CaV2jUeqYekZ8Mqv3kTSCjw7UQAY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Neyt1YXM8HthUvxOY6bexAYiaKAbzw1PoW2uxdwFeh+/i8sIYWthomb2WGDLdl aOeWwsaUryU+Ol8+lUUhQ+t6CfttB8ZLK0xFLG2kXk7f38vMgFSiZ8LVWqPe4Yyo rsHt2r8iNzeS4rBQ/S30qI9fT65h5XyY05nik5E7MHOos=; Received: (qmail 9793 invoked by alias); 6 Mar 2013 18:01:42 -0000 Received: (qmail 9693 invoked by uid 22791); 6 Mar 2013 18:01:39 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Mar 2013 18:01:05 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 29BE2290008 for ; Wed, 6 Mar 2013 19:01:04 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FLIPuYIiL8dq for ; Wed, 6 Mar 2013 19:01:04 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 06D56290036 for ; Wed, 6 Mar 2013 19:01:04 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix internal error on aggregate with small misaligned field Date: Wed, 06 Mar 2013 18:59:13 +0100 Message-ID: <2518340.Lv9NPpTPbW@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 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 This is another regression present on the mainline. The compiler aborts on an aggregate whose type is a record type with a misaligned scalar component and with a representation clause for this component that gives it a size smaller than the default. We're incorrectly laying out the type. Tested on x86_64-suse-linux, applied on the mainline. 2013-03-06 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_field): Remove the wrapper around a misaligned integral type if a size is specified for the field. 2013-03-06 Eric Botcazou * gnat.dg/specs/aggr6.ads: New test. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 196487) +++ gcc-interface/decl.c (working copy) @@ -6619,6 +6619,13 @@ gnat_to_gnu_field (Entity_Id gnat_field, <= 0) gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type)); + /* Similarly if the field's type is a misaligned integral type, but + there is no restriction on the size as there is no justification. */ + if (!needs_strict_alignment + && TYPE_IS_PADDING_P (gnu_field_type) + && INTEGRAL_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_field_type)))) + gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type)); + gnu_field_type = make_type_from_size (gnu_field_type, gnu_size, Has_Biased_Representation (gnat_field));