From: Jakub Jelinek Date: Wed, 3 Jan 2018 12:17:05 +0000 (+0100) Subject: re PR preprocessor/83602 (ICE in cpp_macro_definition_location(cpp_hashnode*) on... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e30947eb0b94078f5d87c84fe111434ef5e1191e;p=gcc.git re PR preprocessor/83602 (ICE in cpp_macro_definition_location(cpp_hashnode*) on invalid code) PR preprocessor/83602 * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def for builtin macros. * g++.dg/cpp/pr83602.C: New test. From-SVN: r256175 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9dfb293e7f3..2fe42b2bb92 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-01-03 Jakub Jelinek + PR preprocessor/83602 + * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def + for builtin macros. + PR c++/83634 * cp-gimplify.c (cp_fold) : If the operand folds to error_mark_node, return error_mark_node. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 95fa52b34b1..cddafab29fe 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -5757,7 +5757,7 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc) /* If we have an exact match for a macro name, then the macro has been used before it was defined. */ cpp_hashnode *macro = bmm.blithely_get_best_candidate (); - if (macro) + if (macro && (macro->flags & NODE_BUILTIN) == 0) return name_hint (NULL, new macro_use_before_def (loc, macro)); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cff788b6a92..d2c1c96ccdb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-01-03 Jakub Jelinek + PR preprocessor/83602 + * g++.dg/cpp/pr83602.C: New test. + PR c++/83634 * g++.dg/parse/pr83634.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp/pr83602.C b/gcc/testsuite/g++.dg/cpp/pr83602.C new file mode 100644 index 00000000000..a07b0e4af59 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp/pr83602.C @@ -0,0 +1,4 @@ +// PR preprocessor/83602 +// { dg-do compile } + +_Pragma // { dg-error "_Pragma" }