]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix up push_local_extern_decl_alias error recovery [PR102642]
authorJakub Jelinek <jakub@redhat.com>
Wed, 20 Oct 2021 06:38:58 +0000 (08:38 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 20 Oct 2021 06:38:58 +0000 (08:38 +0200)
commit424945258d1778617b5d3d5273f6e1c10e718f80
tree99a26d12e244655ae21bb66b3caee304dcf08411
parentd8edfadfc7a9795b65177a50ce44fd348858e844
c++: Fix up push_local_extern_decl_alias error recovery [PR102642]

My recent push_local_extern_decl_alias change broke error-recovery,
do_pushdecl can return error_mark_node and set_decl_tls_model can't be
called on that.  There are other code paths that store error_mark_node
into DECL_LOCAL_DECL_ALIAS, with the intent to differentiate the cases
where we haven't yet tried to push it into the namespace scope (NULL)
and one where we have tried it but it failed (error_mark_node), but looking
around, there are other spots where we call functions or do processing
which doesn't tolerate error_mark_node.

So, the first hunk with the testcase fixes the testcase, the others
fix what I've spotted and the fix was easy to figure out (there are I think
3 other spots mainly for function multiversioning).

2021-10-20  Jakub Jelinek  <jakub@redhat.com>

PR c++/102642
* name-lookup.c (push_local_extern_decl_alias): Don't call
set_decl_tls_model on error_mark_node.
* decl.c (make_rtl_for_nonlocal_decl): Don't call
set_user_assembler_name on error_mark_node.
* parser.c (cp_parser_oacc_declare): Ignore DECL_LOCAL_DECL_ALIAS
if it is error_mark_node.
(cp_parser_omp_declare_target): Likewise.

* g++.dg/tls/pr102642.C: New test.
gcc/cp/decl.c
gcc/cp/name-lookup.c
gcc/cp/parser.c
gcc/testsuite/g++.dg/tls/pr102642.C [new file with mode: 0644]