Commit 1b81b789 by Jason Merrill Committed by Jason Merrill

alias.c (get_alias_set): Return a previously calculated alias set for a VAR_DECL.

        * alias.c (get_alias_set): Return a previously calculated
        alias set for a VAR_DECL.

From-SVN: r44683
parent e13ef1e2
2001-08-07 Jason Merrill <jason_merrill@redhat.com>
* alias.c (get_alias_set): Return a previously calculated
alias set for a VAR_DECL.
2001-08-06 Richard Henderson <rth@redhat.com>
* varasm.c (assemble_gc_entry): Remove.
......
......@@ -527,6 +527,13 @@ get_alias_set (t)
return 0;
}
/* If we've already determined the alias set for this decl, just
return it. This is necessary for C++ anonymous unions, whose
component variables don't look like union members (boo!). */
if (TREE_CODE (t) == VAR_DECL
&& DECL_RTL_SET_P (t) && GET_CODE (DECL_RTL (t)) == MEM)
return MEM_ALIAS_SET (DECL_RTL (t));
/* Give the language another chance to do something special. */
if (orig_t != t
&& (set = lang_get_alias_set (t)) != -1)
......
// Test that type punning using an anonymous union works with strict aliasing.
// { dg-do run }
// { dg-options -O2 -fstrict-aliasing }
extern "C" void abort ();
void f (int i)
{
union
{
int ui;
float uf[2];
};
ui = i;
if (uf[0] != 42.0)
abort ();
}
int main ()
{
union U { int i; float f[2]; } u;
u.f[0] = 42.0;
f (u.i);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment