From patchwork Tue Jul 3 08:49:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 168737 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 1E9B42C00CC for ; Tue, 3 Jul 2012 18:53:32 +1000 (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=1341910413; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version: Content-Type:Message-Id:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=xNpVTYWT+sr2Vp3X8H1X5Qw1mEQ=; b=vAjVmHvEfY3rG4+ Sb/mkNkLAnb+BIk5p74rwk+vkmIaVcfI/3XYvRLqI1WdPPBSYLeFp8TlKv3S3s1r hL7YIj7STnVWkK76+69xcxRHHZXrreBwOMPHi8MgLaSDuk0pLVWzHZhj10yc44mY Rczrm/jK7WWiDcgulT3ROFqY4u0I= 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:User-Agent:MIME-Version:Content-Type:Message-Id:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=dsCuSV0kA//3wGQjAjFOJ/lgX8DrBUV3kHxBXSH740fXRrMvtMKbvuZ/Ygtq+q 0rJNlCTN4ol9G4QKhqWptxLMRRYCuwPZ2rE6VAwxSyDhJQaUTyR5VeJmKZxN+ULU PMTQ5iIN41jggKYIVk4cm0ppZAtyp0O6ikkV+ub9a2Lw8=; Received: (qmail 5640 invoked by alias); 3 Jul 2012 08:53:25 -0000 Received: (qmail 5626 invoked by uid 22791); 3 Jul 2012 08:53:22 -0000 X-SWARE-Spam-Status: No, hits=-2.1 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; Tue, 03 Jul 2012 08:53:10 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B77B229004A for ; Tue, 3 Jul 2012 10:53:14 +0200 (CEST) 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 aWC+wKGaKPHJ for ; Tue, 3 Jul 2012 10:53:14 +0200 (CEST) Received: from [192.168.1.2] (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 65EA6290049 for ; Tue, 3 Jul 2012 10:53:14 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix ICE on renaming with discriminated tagged type Date: Tue, 3 Jul 2012 10:49:21 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201207031049.21799.ebotcazou@adacore.com> 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 a regression present on the mainline and 4.7 branch. The compiler aborts on the renaming of an object with a derived discriminated tagged type converted to the parent type, if the parent type is itself derived from a root discriminated tagged type and the renaming is later used as a prefix in the selection of a component inherited from the root type. Tested on i586-suse-linux, applied on mainline and 4.7 branch. 2012-07-03 Eric Botcazou * gcc-interface/utils2.c (build_simple_component_ref): Do not look through an extension if the type contains a placeholder. 2012-07-03 Eric Botcazou * gnat.dg/discr37.ad[sb]: New test. Index: gcc-interface/utils2.c =================================================================== --- gcc-interface/utils2.c (revision 189034) +++ gcc-interface/utils2.c (working copy) @@ -1912,10 +1912,12 @@ build_simple_component_ref (tree record_ break; /* Next, see if we're looking for an inherited component in an extension. - If so, look thru the extension directly. */ + If so, look thru the extension directly, but not if the type contains + a placeholder, as it might be needed for a later substitution. */ if (!new_field && TREE_CODE (record_variable) == VIEW_CONVERT_EXPR && TYPE_ALIGN_OK (record_type) + && !type_contains_placeholder_p (record_type) && TREE_CODE (TREE_TYPE (TREE_OPERAND (record_variable, 0))) == RECORD_TYPE && TYPE_ALIGN_OK (TREE_TYPE (TREE_OPERAND (record_variable, 0))))