diff options
author | Patrick Palka <ppalka@redhat.com> | 2020-04-15 12:47:41 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2020-04-16 08:58:40 -0400 |
commit | effcb4181e143bc390286a489ff849768a49f6af (patch) | |
tree | 1f8b06662fc21d4c9b0103fa8520b773d2404f1f /gcc/ipa-inline-transform.c | |
parent | 44b326839d864fc10c459916abcc97f35a9ac3de (diff) | |
download | gcc-effcb4181e143bc390286a489ff849768a49f6af.zip gcc-effcb4181e143bc390286a489ff849768a49f6af.tar.gz gcc-effcb4181e143bc390286a489ff849768a49f6af.tar.bz2 |
c++: Error recovery with erroneous DECL_INITIAL [PR94475]
Here we're ICE'ing in do_narrow during error-recovery, because ocp_convert
returns error_mark_node after it attempts to reduce a const decl to its
erroneous DECL_INITIAL via scalar_constant_value, and we later pass this
error_mark_node to fold_build2 which isn't prepared to handle error_mark_nodes.
We could fix this ICE in do_narrow by checking if ocp_convert returns
error_mark_node, but for the sake of consistency and for better error recovery
it seems it'd be preferable if ocp_convert didn't care that a const decl's
initializer is erroneous and would instead proceed as if the decl was not const,
which is the approach that this patch takes.
gcc/cp/ChangeLog:
PR c++/94475
* cvt.c (ocp_convert): If the result of scalar_constant_value is
erroneous, ignore it and use the original expression.
gcc/testsuite/ChangeLog:
PR c++/94475
* g++.dg/conversion/err-recover2.C: New test.
* g++.dg/diagnostic/pr84138.C: Remove now-bogus warning.
* g++.dg/warn/Wsign-compare-8.C: Remove now-bogus warning.
Diffstat (limited to 'gcc/ipa-inline-transform.c')
0 files changed, 0 insertions, 0 deletions