re PR target/67405 (ICE on invalid use of struct on x86_64-linux-gnu)
authorIlya Enkovich <enkovich.gnu@gmail.com>
Tue, 1 Sep 2015 14:38:42 +0000 (14:38 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Tue, 1 Sep 2015 14:38:42 +0000 (14:38 +0000)
gcc/

PR target/67405
* tree-chkp.c (chkp_find_bound_slots_1): Add NULL check.

gcc/testsuite/

PR target/67405
* g++.dg/pr67405.C: New test.

From-SVN: r227373

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr67405.C [new file with mode: 0644]
gcc/tree-chkp.c

index 925546afa4bb9aa5102bf94a8db496cb9a2f3467..8ad749f8f21342d21d644b44b2fec4473fa8fc35 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-01  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR target/67405
+       * tree-chkp.c (chkp_find_bound_slots_1): Add NULL check.
+
 2015-09-01  Aldy Hernandez  <aldyh@redhat.com>
 
        * trans-mem.c: Add contributed-by.
index 3d83499b6053fd2c20b491e9b0e5b77a92ad643f..887e03f8117d9545517142a164560da0336eaf91 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-01  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR target/67405
+       * g++.dg/pr67405.C: New test.
+
 2015-09-01  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * gcc.dg/vect/no-scevccp-outer-11.c: Don't xfail scan-tree-dump-times.
diff --git a/gcc/testsuite/g++.dg/pr67405.C b/gcc/testsuite/g++.dg/pr67405.C
new file mode 100644 (file)
index 0000000..5055921
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-do compile }
+
+struct S
+{
+  S f; // { dg-error "incomplete type" }
+};
+
+void
+fn1 (S p1)
+{
+}
index 8c1b48cf45c8a320a982f32a8e72cf182003618a..2489abb2cb0f8a53994b7f0716fb1503410c0dfc 100644 (file)
@@ -1667,8 +1667,9 @@ chkp_find_bound_slots_1 (const_tree type, bitmap have_bound,
       for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
        if (TREE_CODE (field) == FIELD_DECL)
          {
-           HOST_WIDE_INT field_offs
-             = TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field));
+           HOST_WIDE_INT field_offs = 0;
+           if (DECL_FIELD_BIT_OFFSET (field))
+             field_offs += TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field));
            if (DECL_FIELD_OFFSET (field))
              field_offs += TREE_INT_CST_LOW (DECL_FIELD_OFFSET (field)) * 8;
            chkp_find_bound_slots_1 (TREE_TYPE (field), have_bound,