This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] PATCH to add_referenced_var
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 22 May 2003 13:17:46 -0400
- Subject: [tree-ssa] PATCH to add_referenced_var
Making my way through the libstdc++ failures...
The 22_locale/money_get failures were due to not recognizing that a string
_Rep member might have changed across a call, because it was accessed
through a const lvalue. The constness of a particular lvalue is
irrelevant; we can only assume something won't change across a call if we
know that the object itself is const.
Of course, const objects can change across constructor or destructor calls,
but only at the beginning and end of their lifetimes, so that shouldn't be
a problem for optimizers.
Booted and tested i686-pc-linux-gnu, applied to tree-ssa branch.
2003-05-22 Jason Merrill <jason@redhat.com>
* tree-dfa.c (add_referenced_var): Read-only INDIRECT_REFs can
also be clobbered by function calls.
*** tree-dfa.c.~1~ 2003-05-22 02:40:36.000000000 -0400
--- tree-dfa.c 2003-05-22 03:08:38.000000000 -0400
*************** add_referenced_var (var, sym, walk_state
*** 2410,2418 ****
VARRAY_PUSH_INT (aliased_objects_alias_set, get_alias_set (var));
num_aliased_objects++;
! /* If the variable is not read-only, it may also be clobbered by
! function calls. */
! if (!TREE_READONLY (var))
{
VARRAY_PUSH_TREE (call_clobbered_vars, var);
num_call_clobbered_vars++;
--- 2410,2418 ----
VARRAY_PUSH_INT (aliased_objects_alias_set, get_alias_set (var));
num_aliased_objects++;
! /* If the variable is not read-only (or if var isn't a variable),
! it may also be clobbered by function calls. */
! if (var != sym || !TREE_READONLY (var))
{
VARRAY_PUSH_TREE (call_clobbered_vars, var);
num_call_clobbered_vars++;