From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21389 invoked by alias); 7 Apr 2011 13:37:28 -0000 Received: (qmail 21378 invoked by uid 22791); 7 Apr 2011 13:37:27 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Apr 2011 13:37:23 +0000 Received: (qmail 11250 invoked from network); 7 Apr 2011 13:37:22 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Apr 2011 13:37:22 -0000 Date: Thu, 07 Apr 2011 13:37:00 -0000 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Subject: [PATCH,c++] fix PR objc++/48479, ICE in cxx_mark_addressable Message-ID: <20110407133715.GA18081@nightcrawler> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00548.txt.bz2 My recent patch removing DECL_RTL from CONST_DECLs caused regressions in the ObjC++ testsuite on Darwin targets. The problem is that DECL_REGISTER was being called on CONST_DECLs; DECL_REGISTER says: /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'. */ #define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0) Previously, the DECL_WRTL_CHECK was succeeding when given CONST_DECLs; it no longer does. The suggested fix is to simply move the CONST_DECL case in cxx_mark_addressable; since DECL_REGISTER would have always returned false for CONST_DECLs, there's no change in functionality. Fixing DECL_REGISTER to accurately reflect its comment would be helpful, but there are other ICEs to fix if DECL_REGISTER only takes PARM_DECL and VAR_DECL; I thought it best to submit that as a separate fix, if at all. Patch was tested on Darwin targets via IainS and Dominique and fixed the regression. OK to commit? -Nathan gcc/cp/ * typeck.c (cxx_mark_addressable) [CONST_DECL]: Mark addressable and return immediately. @@ -5373,7 +5373,6 @@ cxx_mark_addressable (tree exp) || DECL_EXTERNAL (x)); /* Fall through. */ - case CONST_DECL: case RESULT_DECL: if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x) && !DECL_ARTIFICIAL (x)) @@ -5391,6 +5390,7 @@ cxx_mark_addressable (tree exp) TREE_ADDRESSABLE (x) = 1; return true; + case CONST_DECL: case FUNCTION_DECL: TREE_ADDRESSABLE (x) = 1; return true;