tree-dfa.c (add_referenced_var): Register initializers of global variables.

2004-07-26  Eric Christopher  <echristo@redhat.com>

	* tree-dfa.c (add_referenced_var): Register initializers of global
	variables.

2004-07-26  Eric Christopher  <echristo@redhat.com>

	* gcc.c-torture/compile/20040726-2.c: New test.

From-SVN: r85214
This commit is contained in:
Eric Christopher 2004-07-27 00:20:03 +00:00
parent 764c35da02
commit ff6a32068d
4 changed files with 68 additions and 29 deletions

View File

@ -1,4 +1,9 @@
2004-07-22 Paolo Bonzini <bonzini@gnu.org>
2004-07-26 Eric Christopher <echristo@redhat.com>
* tree-dfa.c (add_referenced_var): Register initializers of global
variables.
2004-07-26 Paolo Bonzini <bonzini@gnu.org>
* config/i386/i386.c (function_arg): Always treat 8-
and 16-byte wide vectors the same, even if MMX/SSE

View File

@ -1,3 +1,7 @@
2004-07-26 Eric Christopher <echristo@redhat.com>
* gcc.c-torture/compile/20040726-2.c: New test.
2004-07-26 Andrew Pinski <apinski@apple.com>
* g++.dg/rtti/tinfo1.C: Xfail.

View File

@ -0,0 +1,22 @@
/* { dg-do compile } */
/* From a failure after the global ccp pass. */
typedef struct
{
char n[129];
} A;
const A C = {
0,
0
};
extern const A *const B;
void bar(const char *);
void foo ()
{
bar (B->n);
}
const A *const B = &C;

View File

@ -903,6 +903,14 @@ add_referenced_var (tree var, struct walk_state *walk_state)
/* Global and static variables are call-clobbered, always. */
if (needs_to_live_in_memory (var))
mark_call_clobbered (var);
/* If an initialized global variable then register the initializer
as well. */
if (POINTER_TYPE_P (TREE_TYPE (var))
&& TREE_READONLY (var)
&& DECL_INITIAL (var)
&& TREE_CODE (DECL_INITIAL (var)) == ADDR_EXPR)
walk_tree (&DECL_INITIAL (var), find_vars_r, walk_state, 0);
}
}