struct vs. scalar-ness when -fno-strict-aliasing.
and a test case to test it, gcc.dg/
20000623-1.c.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34668
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
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.
--- /dev/null
+/* { 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; }