aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-12-02 19:29:17 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-12-02 19:29:17 +0000
commitd6221ad4589004958d05d4ac3cb7104881dfe896 (patch)
tree9db43fa3298a0062b79157e3f4c3b81bbfef6ef2 /gcc
parent105b682e138221fe33886c43379cdf3110112c74 (diff)
downloadgcc-d6221ad4589004958d05d4ac3cb7104881dfe896.zip
gcc-d6221ad4589004958d05d4ac3cb7104881dfe896.tar.gz
gcc-d6221ad4589004958d05d4ac3cb7104881dfe896.tar.bz2
re PR c++/68653 (ICE: in nonnull_arg_p, at tree.c:13853)
PR c++/68653 * tree.c (nonnull_arg_p): Allow OFFSET_TYPE. * g++.dg/warn/nonnull3.C: New test. From-SVN: r231200
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/warn/nonnull3.C19
-rw-r--r--gcc/tree.c4
4 files changed, 32 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d335b2e..845d909 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-02 Marek Polacek <polacek@redhat.com>
+
+ PR c++/68653
+ * tree.c (nonnull_arg_p): Allow OFFSET_TYPE.
+
2015-12-02 Nathan Sidwell <nathan@acm.org>
* config/nvptx/nvptx.c (enum nvptx_shuffle_kind): New. Absorb
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index feb0a0a..e8291a9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-02 Marek Polacek <polacek@redhat.com>
+
+ PR c++/68653
+ * g++.dg/warn/nonnull3.C: New test.
+
2015-12-02 Joseph Myers <joseph@codesourcery.com>
PR c/68162
diff --git a/gcc/testsuite/g++.dg/warn/nonnull3.C b/gcc/testsuite/g++.dg/warn/nonnull3.C
new file mode 100644
index 0000000..d82fa31
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/nonnull3.C
@@ -0,0 +1,19 @@
+// PR c++/68653
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall" }
+
+struct B;
+struct A {
+ template <typename T> __attribute__((nonnull)) bool foo (int T::*);
+ void bar (B *);
+};
+
+template <typename T> bool A::foo (int T::*p)
+{
+ return p;
+}
+void A::bar (B *)
+{
+ foo ((int B::*) nullptr);
+}
+// { dg-warning "nonnull argument" "" {target "*-*-*"} 0 }
diff --git a/gcc/tree.c b/gcc/tree.c
index 587bd74..bd5cf73 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -13848,7 +13848,9 @@ nonnull_arg_p (const_tree arg)
tree t, attrs, fntype;
unsigned HOST_WIDE_INT arg_num;
- gcc_assert (TREE_CODE (arg) == PARM_DECL && POINTER_TYPE_P (TREE_TYPE (arg)));
+ gcc_assert (TREE_CODE (arg) == PARM_DECL
+ && (POINTER_TYPE_P (TREE_TYPE (arg))
+ || TREE_CODE (TREE_TYPE (arg)) == OFFSET_TYPE));
/* The static chain decl is always non null. */
if (arg == cfun->static_chain_decl)