This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/13472] [3.3 Regression] optimizer generates code to store data in const int, resulting in a segfault
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Dec 2003 14:19:18 -0000
- Subject: [Bug optimization/13472] [3.3 Regression] optimizer generates code to store data in const int, resulting in a segfault
- References: <20031223020924.13472.p.van-hoof@qub.ac.uk>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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