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
This commit is contained in:
parent
56e3dd2cea
commit
3e0abe15d1
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2000-06-23 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
* cpplib.c (struct pragma_entry): New structure.
|
* 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;
|
rtx mem1_addr, mem2_addr;
|
||||||
int (*varies_p) PARAMS ((rtx));
|
int (*varies_p) PARAMS ((rtx));
|
||||||
{
|
{
|
||||||
|
if (! flag_strict_aliasing)
|
||||||
|
return NULL_RTX;
|
||||||
|
|
||||||
if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2)
|
if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2)
|
||||||
&& !varies_p (mem1_addr) && varies_p (mem2_addr))
|
&& !varies_p (mem1_addr) && varies_p (mem2_addr))
|
||||||
/* MEM1 is a scalar at a fixed address; MEM2 is a struct at a
|
/* MEM1 is a scalar at a fixed address; MEM2 is a struct at a
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2000-06-23 Geoffrey Keating <geoffk@cygnus.com>
|
||||||
|
|
||||||
|
* gcc.dg/20000623-1.c: New test.
|
||||||
|
|
||||||
2000-06-22 Jakub Jelinek <jakub@redhat.com>
|
2000-06-22 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* gcc.c-torture/execute/20000622-1.c: New test.
|
* gcc.c-torture/execute/20000622-1.c: New test.
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/* { 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; }
|
Loading…
Reference in New Issue