[Bug c++/102600] [modules] ICE Segmentation fault during GIMPLE pass evrp
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 25 17:41:55 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102600
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:15d67c11ac0479b08e3badcafdee7e0a6f062349
commit r13-3491-g15d67c11ac0479b08e3badcafdee7e0a6f062349
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Oct 25 13:41:18 2022 -0400
c++ modules: enum TYPE_MIN/MAX_VALUE streaming [PR106848]
In the frontend, the TYPE_MIN/MAX_VALUE of ENUMERAL_TYPE is the same as
that of the enum's underlying type (see start_enum). And the underlying
type of an enum is always known, even for an opaque enum that lacks a
definition.
But currently, we stream TYPE_MIN/MAX_VALUE of an enum only as part of
its definition. So if the enum is declared but never defined, the
ENUMERAL_TYPE we stream in will have empty TYPE_MIN/MAX_VALUE fields
despite these fields being non-empty on stream out.
And even if the enum is defined, read_enum_def updates these fields only
on the main variant of the enum type, so for other variants (that we may
have streamed in earlier) these fields remain empty. That these fields
are unexpectedly empty for some ENUMERAL_TYPEs is ultimately the cause
of the below two PRs.
This patch fixes this by making us stream TYPE_MIN/MAX_VALUE directly
for each ENUMERAL_TYPE rather than as part of the enum's definition, so
that we naturally also stream these fields for opaque enums (and each
enum type variant).
PR c++/106848
PR c++/102600
gcc/cp/ChangeLog:
* module.cc (trees_out::core_vals): Stream TYPE_MAX_VALUE and
TYPE_MIN_VALUE of ENUMERAL_TYPE.
(trees_in::core_vals): Likewise.
(trees_out::write_enum_def): Don't stream them here.
(trees_in::read_enum_def): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/modules/enum-9_a.H: New test.
* g++.dg/modules/enum-9_b.C: New test.
* g++.dg/modules/enum-10_a.H: New test.
* g++.dg/modules/enum-10_b.C: New test.
* g++.dg/modules/enum-11_a.H: New test.
* g++.dg/modules/enum-11_b.C: New test.
More information about the Gcc-bugs
mailing list