PR c/83056 reports an issue affecting trunk and gcc-7 in which
the C frontend's implementation of lookup_name_fuzzy uses undeclared
identifiers as suggestions when encountering subsequent undeclared
identifiers.
The fix is to filter out the names bound to error_mark_node
in lookup_name_fuzzy.
The C++ frontend is unaffected, as it already does this.
gcc/c/ChangeLog:
PR c/83056
* c-decl.c (lookup_name_fuzzy): Don't suggest names that came from
earlier failed lookups.
gcc/testsuite/ChangeLog:
PR c/83056
* gcc.dg/spellcheck-pr83056.c: New test case.
From-SVN: r255038
+2017-11-21 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/83056
+ * c-decl.c (lookup_name_fuzzy): Don't suggest names that came from
+ earlier failed lookups.
+
2017-11-21 Marc Glisse <marc.glisse@inria.fr>
* c-fold.c (c_fully_fold_internal): Handle POINTER_DIFF_EXPR.
{
if (!binding->id || binding->invisible)
continue;
+ if (binding->decl == error_mark_node)
+ continue;
/* Don't use bindings from implicitly declared functions,
as they were likely misspellings themselves. */
if (TREE_CODE (binding->decl) == FUNCTION_DECL)
+2017-11-21 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/83056
+ * gcc.dg/spellcheck-pr83056.c: New test case.
+
2017-11-21 Martin Sebor <msebor@redhat.com>
PR tree-optimization/82945
--- /dev/null
+enum { TYPE_A };
+
+/* Verify that the incorrect "TYPE_B" etc don't get re-used for
+ suggestions for the later incorrect values. */
+
+void pr83056(void)
+{
+ int b = TYPE_B; /* { dg-error "did you mean 'TYPE_A'" } */
+ int c = TYPE_C; /* { dg-error "did you mean 'TYPE_A'" } */
+ int d = TYPE_D; /* { dg-error "did you mean 'TYPE_A'" } */
+}