* tree-ssa-sccvn.c (vn_reference_lookup_3): Bail out instead of
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 31 Oct 2009 15:42:14 +0000 (15:42 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 31 Oct 2009 15:42:14 +0000 (15:42 +0000)
aborting if the sizes of the two references don't match.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153777 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/rep_clause4.ads [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index d853706..6a4c7ee 100644 (file)
@@ -1,3 +1,8 @@
+2009-10-31  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree-ssa-sccvn.c (vn_reference_lookup_3): Bail out instead of
+       aborting if the sizes of the two references don't match.
+
 2009-10-31  Toon Moene  <toon@moene.org>
 
        * ipa-inline.c (cgraph_decide_inlining):
index 042b4ec..14c8a50 100644 (file)
@@ -1,9 +1,12 @@
+2009-10-31  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/specs/rep_clause4.ads: New test.
+
 2009-10-30  Andy Hutchinson  <hutchinsonandy@gcc.gnu.org>
 
        PR target/41885
        * gcc.target/avr/torture/pr41885.c: New test.
 
-
 2009-10-30  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/specs/pack5.ads: New test.
diff --git a/gcc/testsuite/gnat.dg/specs/rep_clause4.ads b/gcc/testsuite/gnat.dg/specs/rep_clause4.ads
new file mode 100644 (file)
index 0000000..8009f87
--- /dev/null
@@ -0,0 +1,42 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+package Rep_Clause4 is
+
+  type Uns16 is mod 2**16;
+
+  type Rec32 is
+    record
+      W1 : Uns16 := 1;
+      W2 : Uns16 := 2;
+    end record;
+  for Rec32 use
+    record
+      W1 at 0 range 0..15;
+      W2 at 2 range 0..15;
+    end record;
+  for Rec32'size use 32;
+
+  type Rec48 is
+    record
+      W1andW2 : Rec32;
+      W3      : Uns16;
+    end record;
+  for Rec48 use
+    record
+      W1andW2 at 0 range 0..31;
+      W3      at 4 range 0..15;
+    end record;
+  for Rec48'size use 48;
+
+  type Rec_Type is
+    record
+      Field1 : Rec48;
+    end record;
+  for Rec_Type use
+    record
+      Field1 at 0 range 0 .. 47;
+    end record;
+  for Rec_Type'size use 48;
+
+end Rep_Clause4;
index 4158fbd..0a8dcaa 100644 (file)
@@ -1157,7 +1157,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
       /* Adjust *ref from the new operands.  */
       if (!ao_ref_init_from_vn_reference (&r, vr->set, vr->type, vr->operands))
        return (void *)-1;
-      gcc_assert (ref->size == r.size);
+      /* This can happen with bitfields.  */
+      if (ref->size != r.size)
+       return (void *)-1;
       *ref = r;
 
       /* Keep looking for the adjusted *REF / VR pair.  */