varasm: Fix ICE with -fsyntax-only [PR99035]
authorJakub Jelinek <jakub@redhat.com>
Wed, 10 Feb 2021 18:52:37 +0000 (19:52 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 10 Feb 2021 18:52:37 +0000 (19:52 +0100)
commit0f39fb7b001df7cdba56cd5c572d0737667acd2c
tree719196d8ef46d0a5f89607a0580b07b51a0de05e
parent20482cfcc1d3b71e0aec57b5b48685bf0b5402ca
varasm: Fix ICE with -fsyntax-only [PR99035]

My FE change from 2 years ago uses TREE_ASM_WRITTEN in -fsyntax-only
mode more aggressively to avoid "expanding" functions multiple times.
With -fsyntax-only nothing is really expanded, so I think it is acceptable
to adjust the assert and allow declare_weak at any time, with -fsyntax-only
we know it is during parsing only anyway.

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

PR c++/99035
* varasm.c (declare_weak): For -fsyntax-only, allow even
TREE_ASM_WRITTEN function decls.

* g++.dg/ext/weak6.C: New test.
gcc/testsuite/g++.dg/ext/weak6.C [new file with mode: 0644]
gcc/varasm.c