From patchwork Wed Dec 15 11:52:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 75638 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 A9E33B6ED0 for ; Wed, 15 Dec 2010 22:54:46 +1100 (EST) Received: (qmail 28803 invoked by alias); 15 Dec 2010 11:54:44 -0000 Received: (qmail 28793 invoked by uid 22791); 15 Dec 2010 11:54:43 -0000 X-SWARE-Spam-Status: No, hits=-2.0 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, 15 Dec 2010 11:54:37 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5BB27CB0219 for ; Wed, 15 Dec 2010 12:54:35 +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 vtRckLnBRyLg for ; Wed, 15 Dec 2010 12:54:35 +0100 (CET) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 1F91CCB01DD for ; Wed, 15 Dec 2010 12:54:35 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix ICE in rtl_for_decl_init Date: Wed, 15 Dec 2010 12:52:47 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201012151252.47942.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 Hi, the attached testcase causes the compiler to ICE in rtl_for_decl_init when it is trying to generate debug info for the constant C. The INIT expression is NOP_EXPR (VIEW_CONVERT_EXPR (CONSTRUCTOR)) with type a scalar type. The code in rtl_for_decl_init already knows how to skip aggregate types, but it doesn't see the inner CONSTRUCTOR. Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline? 2010-12-15 Eric Botcazou * dwarf2out.c (rtl_for_decl_init): Strip no-op conversions off the initializer. Skip view conversions from aggregate types. 2010-12-15 Eric Botcazou * gnat.dg/unchecked_convert8.ad[sb]: New test. Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 167721) +++ dwarf2out.c (working copy) @@ -16526,6 +16526,8 @@ rtl_for_decl_init (tree init, tree type) { rtx rtl = NULL_RTX; + STRIP_NOPS (init); + /* If a variable is initialized with a string constant without embedded zeros, build CONST_STRING. */ if (TREE_CODE (init) == STRING_CST && TREE_CODE (type) == ARRAY_TYPE) @@ -16550,7 +16552,10 @@ rtl_for_decl_init (tree init, tree type) } /* Other aggregates, and complex values, could be represented using CONCAT: FIXME! */ - else if (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE) + else if (AGGREGATE_TYPE_P (type) + || (TREE_CODE (init) == VIEW_CONVERT_EXPR + && AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (init, 0)))) + || TREE_CODE (type) == COMPLEX_TYPE) ; /* Vectors only work if their mode is supported by the target. FIXME: generic vectors ought to work too. */