From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 529 invoked by alias); 23 Dec 2003 14:19:19 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 522 invoked by uid 48); 23 Dec 2003 14:19:18 -0000 Date: Tue, 23 Dec 2003 14:50:00 -0000 Message-ID: <20031223141918.520.qmail@sources.redhat.com> From: "ebotcazou at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20031223020924.13472.p.van-hoof@qub.ac.uk> References: <20031223020924.13472.p.van-hoof@qub.ac.uk> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/13472] [3.3 Regression] optimizer generates code to store data in const int, resulting in a segfault X-Bugzilla-Reason: CC X-SW-Source: 2003-12/txt/msg02476.txt.bz2 List-Id: ------- Additional Comments From ebotcazou at gcc dot gnu dot org 2003-12-23 14:19 ------- The final culprit is the reload pass: it generates the store (although the MEM is marked as unchanging) because it thinks the memory location is a regular spill slot. It appears that the reload pass doesn't care about the /u flag when recording equivalent memory locations based on the presence of REG_EQUIV notes. But I don't know if this is really a reload problem: maybe reload implicitly expects full equivalence between objects in pairs that carry REG_EQUIV notes. In any cases, the dependence upon -pedantic is certainly a bug and is actually recognized as such in the code (c-typeck.c:790): /* Return either DECL or its known constant value (if it has one), but return DECL if pedantic or DECL has mode BLKmode. This is for bug-compatibility with the old behavior of decl_constant_value (before GCC 3.0); every use of this function is a bug and it should be removed before GCC 3.1. It is not appropriate to use pedantic in a way that affects optimization, and BLKmode is probably not the right test for avoiding misoptimizations either. */ static tree decl_constant_value_for_broken_optimization (decl) tree decl; { if (pedantic || DECL_MODE (decl) == BLKmode) return decl; else return decl_constant_value (decl); } So I think the fix is to remove decl_constant_value_for_broken_optimization altogether from the C front-end. But this is probably not doable on a release branch. -- What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |ebotcazou at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13472