OSDN Git Service

* alias.c (fixed_scalar_and_varying_struct_p): Don't examine
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Jun 2000 20:05:55 +0000 (20:05 +0000)
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Jun 2000 20:05:55 +0000 (20:05 +0000)
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

gcc/ChangeLog
gcc/alias.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20000623-1.c [new file with mode: 0644]

index 78d3f0d..21e230c 100644 (file)
@@ -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>
 
        * cpplib.c (struct pragma_entry): New structure.
index 07f8701..55cc212 100644 (file)
@@ -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
index b3ad82b..5b7babe 100644 (file)
@@ -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>
 
        * gcc.c-torture/execute/20000622-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/20000623-1.c b/gcc/testsuite/gcc.dg/20000623-1.c
new file mode 100644 (file)
index 0000000..0a5cd24
--- /dev/null
@@ -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; }