re PR tree-optimization/33856 (Segfault in create_data_ref/compute_data_dependences_f...
authorJakub Jelinek <jakub@redhat.com>
Mon, 5 Nov 2007 08:44:23 +0000 (09:44 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 5 Nov 2007 08:44:23 +0000 (09:44 +0100)
PR tree-optimization/33856
* tree-data-ref.c (get_references_in_stmt): Don't add
REFERENCE_CLASS_P trees to references vector if get_base_address
returns NULL on them.

* gcc.c-torture/compile/20071027-1.c: New test.

From-SVN: r129897

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20071027-1.c [new file with mode: 0644]
gcc/tree-data-ref.c

index 42c79ff9b97fd17f826d75244c2659c3a81f4c69..0b546ded61b02acad8e48692c9fbea5a1dbd39db 100644 (file)
@@ -1,3 +1,10 @@
+2007-11-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/33856
+       * tree-data-ref.c (get_references_in_stmt): Don't add
+       REFERENCE_CLASS_P trees to references vector if get_base_address
+       returns NULL on them.
+
 2007-11-05  Alexandre Oliva  <aoliva@redhat.com>
 
        * cfg.c (dump_cfg_bb_info): Update bb_bitnames to match enum.
index 69d30f90b9eacf4c762b6f0d35e00b5cb2e5eac6..f8f4ed13ae0d450cb1cf9fe9eebf2c09e897d5b8 100644 (file)
@@ -1,5 +1,8 @@
 2007-11-05  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/33856
+       * gcc.c-torture/compile/20071027-1.c: New test.
+
        PR c++/33836
        * g++.dg/ext/label10.C: New test.
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/20071027-1.c b/gcc/testsuite/gcc.c-torture/compile/20071027-1.c
new file mode 100644 (file)
index 0000000..c550406
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR tree-optimization/33856 */
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+typedef struct z_key
+{
+  int key;
+  int mask;
+} z_key;
+typedef struct picture_size
+{
+  z_key key;
+} picture_size;
+
+void picture_size_new (picture_size *ps)
+{
+  z_key key;
+  ps->key = key;
+}
+
+void picture_sizes_load_default (picture_size *ps)
+{
+  int i;
+  for (i = 0; i < 5; ++i)
+    picture_size_new (ps);
+}
index 17851ee3cd071983d9c989f9b2482c3e6848afd4..bf7d2ab6aea0d684a95009716a4ed079280818f1 100644 (file)
@@ -3913,7 +3913,7 @@ get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
       op1 = &GIMPLE_STMT_OPERAND (stmt, 1);
                
       if (DECL_P (*op1)
-         || REFERENCE_CLASS_P (*op1))
+         || (REFERENCE_CLASS_P (*op1) && get_base_address (*op1)))
        {
          ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
          ref->pos = op1;
@@ -3921,7 +3921,7 @@ get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
        }
 
       if (DECL_P (*op0)
-         || REFERENCE_CLASS_P (*op0))
+         || (REFERENCE_CLASS_P (*op0) && get_base_address (*op0)))
        {
          ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
          ref->pos = op0;
@@ -3938,7 +3938,7 @@ get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
          op0 = &CALL_EXPR_ARG (call, i);
 
          if (DECL_P (*op0)
-             || REFERENCE_CLASS_P (*op0))
+             || (REFERENCE_CLASS_P (*op0) && get_base_address (*op0)))
            {
              ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
              ref->pos = op0;