re PR middle-end/27409 (ICE in get_constraint_for_component_ref)
authorRichard Guenther <rguenther@suse.de>
Sun, 7 May 2006 21:03:55 +0000 (21:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 7 May 2006 21:03:55 +0000 (21:03 +0000)
2006-05-07  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/27409
* tree-ssa-structalias.c (get_constraint_for_component_ref):
Do not try to find zero-sized subvars.

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

From-SVN: r113607

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

index bc2117483c5f890ff441b6eb481cfec8e852a670..7f3cd34604d02bcd14a6a69cc9ed98b1c788bf61 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-07  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/27409
+       * tree-ssa-structalias.c (get_constraint_for_component_ref):
+       Do not try to find zero-sized subvars.
+
 2006-05-07  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/27136
index 5ac84b03a21c0de4166f714c9bff85d3477386e3..7041216ac224e9f9a95a3d8ee6e750c5cfb5c1a4 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-07  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/27409
+       * gcc.dg/torture/pr27409.c: New testcase.
+
 2006-05-07  Tobias Schlüter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/27457
diff --git a/gcc/testsuite/gcc.dg/torture/pr27409.c b/gcc/testsuite/gcc.dg/torture/pr27409.c
new file mode 100644 (file)
index 0000000..430e6c8
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+typedef struct {
+        struct { } z;
+} thang_t;
+
+struct {
+        short           e;
+        thang_t         f;
+        int g;
+} my_struct;
+
+void function(int blaz)
+{
+  thang_t *fp = &my_struct.f;
+  foo(fp);
+}
index c5b6cabaadb965824da65ad0317aa5510b94c8d2..26dbd0dcca70f3e9d2f81d9b9e373185d2812d1f 100644 (file)
@@ -2378,7 +2378,8 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
         ignore this constraint. When we handle pointer subtraction,
         we may have to do something cute here.  */
       
-      if (result->offset < get_varinfo (result->var)->fullsize)
+      if (result->offset < get_varinfo (result->var)->fullsize
+         && bitmaxsize != 0)
        {
          /* It's also not true that the constraint will actually start at the
             right offset, it may start in some padding.  We only care about
@@ -2400,6 +2401,12 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
             embedded in a struct resulting in accessing *only* padding.  */
          gcc_assert (curr || ref_contains_array_ref (orig_t));
        }
+      else if (bitmaxsize == 0)
+       {
+         if (dump_file && (dump_flags & TDF_DETAILS))
+           fprintf (dump_file, "Access to zero-sized part of variable,"
+                    "ignoring\n");
+       }
       else
        if (dump_file && (dump_flags & TDF_DETAILS))
          fprintf (dump_file, "Access to past the end of variable, ignoring\n");