Commit 3e0abe15 by Geoff Keating Committed by Geoffrey Keating

alias.c (fixed_scalar_and_varying_struct_p): Don't examine struct vs.

* alias.c (fixed_scalar_and_varying_struct_p): Don't examine
struct vs. scalar-ness when -fno-strict-aliasing.

and a test case to test it, gcc.dg/20000623-1.c.

From-SVN: r34668
parent 56e3dd2c
2000-06-23 Geoffrey Keating <geoffk@cygnus.com>
* alias.c (fixed_scalar_and_varying_struct_p): Don't examine
struct vs. scalar-ness when -fno-strict-aliasing.
2000-06-23 Nathan Sidwell <nathan@codesourcery.com>
* cpplib.c (struct pragma_entry): New structure.
......
......@@ -1523,6 +1523,9 @@ fixed_scalar_and_varying_struct_p (mem1, mem2, mem1_addr, mem2_addr, varies_p)
rtx mem1_addr, mem2_addr;
int (*varies_p) PARAMS ((rtx));
{
if (! flag_strict_aliasing)
return NULL_RTX;
if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2)
&& !varies_p (mem1_addr) && varies_p (mem2_addr))
/* MEM1 is a scalar at a fixed address; MEM2 is a struct at a
......
2000-06-23 Geoffrey Keating <geoffk@cygnus.com>
* gcc.dg/20000623-1.c: New test.
2000-06-22 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20000622-1.c: New test.
......
/* { dg-do run } */
/* { dg-options "-O3 -fno-strict-aliasing" } */
struct foos { int l; };
int foo;
static struct foos *getfoo(void);
int main (void)
{
struct foos *f = getfoo();
f->l = 1;
foo = 2;
if (f->l == 1)
abort();
exit(0);
}
static struct foos *getfoo(void)
{ return (struct foos *)&foo; }
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