checking: avoid verify_type_variant crash on incomplete type.
authorJason Merrill <jason@redhat.com>
Sun, 26 Jan 2020 04:09:57 +0000 (23:09 -0500)
committerJason Merrill <jason@redhat.com>
Sun, 26 Jan 2020 18:41:05 +0000 (13:41 -0500)
commit091fe099ba9093b8577ad4a10b56e18c6ea3daea
tree57cf93c8d10aa9c80e46a6c1e56288578f0cdb93
parent0f6f39ed733e9462dbeef9dd56d52b21b8cd67c5
checking: avoid verify_type_variant crash on incomplete type.

Here, we end up calling gen_type_die_with_usage for a type that's in the
middle of finish_struct_1, after we set TYPE_NEEDS_CONSTRUCTING on it but
before we copy all the flags to the variants--and, significantly, before we
set its TYPE_SIZE.  It seems reasonable to only look at
TYPE_NEEDS_CONSTRUCTING on complete types, since we aren't going to try to
create an object of an incomplete type any other way.

PR c++/92601
* tree.c (verify_type_variant): Only verify TYPE_NEEDS_CONSTRUCTING
of complete types.
gcc/ChangeLog
gcc/testsuite/g++.dg/debug/verify1.C [new file with mode: 0644]
gcc/tree.c