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: Tue, 05 Aug 2003 17:04:49 -0400
- Subject: [tree-ssa] PATCH to add_referenced_var
A static local variable in a function f can be clobbered by a recursive call,
or a call from one function which inlines f to another.
New test in gcc.dg/20030805-1.c.
Tested athlon-pc-linux-gnu, applied to tree-ssa.
2003-08-05 Jason Merrill <jason@redhat.com>
* tree-dfa.c (add_referenced_var): Static locals are call
clobbered.
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.140
diff -c -p -r1.1.4.140 tree-dfa.c
*** tree-dfa.c 5 Aug 2003 15:19:03 -0000 1.1.4.140
--- tree-dfa.c 5 Aug 2003 20:16:40 -0000
*************** add_referenced_var (tree var, struct wal
*** 2382,2390 ****
VARRAY_PUSH_GENERIC_PTR (addressable_vars, (void *) alias_map);
}
! /* Addressable variables and memory tags may be used or clobbered by
! function calls. */
! if (is_addressable || v_ann->is_mem_tag)
{
add_call_clobbered_var (var);
v_ann->is_call_clobbered = 1;
--- 2382,2392 ----
VARRAY_PUSH_GENERIC_PTR (addressable_vars, (void *) alias_map);
}
! /* Addressable variables, memory tags and static locals may be used
! or clobbered by function calls. */
! if (is_addressable
! || v_ann->is_mem_tag
! || (var != global_var && TREE_STATIC (var)))
{
add_call_clobbered_var (var);
v_ann->is_call_clobbered = 1;