OSDN Git Service

2005-12-18 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 18 Dec 2005 22:20:31 +0000 (22:20 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 18 Dec 2005 22:20:31 +0000 (22:20 +0000)
PR tree-optimization/25481
* tree-ssa-structalias.c (handle_ptr_arith): Handle
accesses we don't have a varinfo for.

* gcc.dg/torture/pr25481.c: New testcase.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr25481.c [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 9846816..6c9d1b5 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-18  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/25481
+       * tree-ssa-structalias.c (handle_ptr_arith): Handle
+       accesses we don't have a varinfo for.
+
 2005-12-17  Jon Grimm  <jgrimm2@us.ibm.com>
            Janis Johnson  <janis187@us.ibm.com>
            Ben Elliston  <bje@au.ibm.com>
index 4174961..c12b788 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-18  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/25481
+       * gcc.dg/torture/pr25481.c: New testcase.
+
 2005-12-18  Ulrich Weigand  <uweigand@de.ibm.com>
 
        PR rtl-optimization/21041
diff --git a/gcc/testsuite/gcc.dg/torture/pr25481.c b/gcc/testsuite/gcc.dg/torture/pr25481.c
new file mode 100644 (file)
index 0000000..3072e5e
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+struct s {
+  int *blah;
+};
+
+static struct s array[] = {
+  { 0 }
+};
+
+void
+foo (struct s *p)
+{
+  unsigned int n = 1;
+  struct s *q = &array[n];
+  while (p < q)
+    p++;
+}
index cf30759..b4251d6 100644 (file)
@@ -3184,9 +3184,13 @@ handle_ptr_arith (VEC (ce_s, heap) *lhsc, tree expr)
        if (c2->type == ADDRESSOF && rhsoffset != 0)
          {
            varinfo_t temp = get_varinfo (c2->var);
-           
-           gcc_assert (first_vi_for_offset (temp, rhsoffset) != NULL);
-           c2->var = first_vi_for_offset (temp, rhsoffset)->id;
+
+           /* An access one after the end of an array is valid,
+              so simply punt on accesses we cannot resolve.  */
+           temp = first_vi_for_offset (temp, rhsoffset);
+           if (temp == NULL)
+             continue;
+           c2->var = temp->id;
            c2->offset = 0;
          }
        else