re PR c/90677 (gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node'...
authorJakub Jelinek <jakub@redhat.com>
Thu, 2 Jan 2020 17:29:59 +0000 (18:29 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 2 Jan 2020 17:29:59 +0000 (18:29 +0100)
PR c/90677
* cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
has not been found, rather than error_mark_node.

* c-c++-common/pr90677-2.c: New test.

From-SVN: r279840

gcc/cp/ChangeLog
gcc/cp/cp-objcp-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr90677-2.c [new file with mode: 0644]

index 35cd60e..35b954c 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/90677
+       * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
+       has not been found, rather than error_mark_node.
+
 2020-01-01  Jakub Jelinek  <jakub@redhat.com>
 
        Update copyright years.
index d2a6800..42eb5ac 100644 (file)
@@ -354,8 +354,11 @@ identifier_global_value (tree name)
 tree
 identifier_global_tag (tree name)
 {
-  return lookup_qualified_name (global_namespace, name, /*prefer_type*/2,
-                               /*complain*/false);
+  tree ret = lookup_qualified_name (global_namespace, name, /*prefer_type*/2,
+                                   /*complain*/false);
+  if (ret == error_mark_node)
+    return NULL_TREE;
+  return ret;
 }
 
 /* Returns true if NAME refers to a built-in function or function-like
index 96289dd..7c959f4 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/90677
+       * c-c++-common/pr90677-2.c: New test.
+
 2020-01-02  Dennis Zhang  <dennis.zhang@arm.com>
 
        * gcc.target/arm/multilib.exp: Add combination tests for armv8.6-a.
diff --git a/gcc/testsuite/c-c++-common/pr90677-2.c b/gcc/testsuite/c-c++-common/pr90677-2.c
new file mode 100644 (file)
index 0000000..1d125e0
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR c/90677 */
+/* { dg-do compile } */
+/* { dg-options "-W -Wall" } */
+
+extern void foo (int, int, const char *, ...)
+  __attribute__ ((__format__ (__gcc_tdiag__, 3, 4)));
+struct cgraph_node;
+extern void bar (struct cgraph_node *);