https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101396
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Xi Ruoyao <xry...@gcc.gnu.org>: https://gcc.gnu.org/g:291416d3782e12e983483a3f7b2154a3dbfc9e1f commit r12-2606-g291416d3782e12e983483a3f7b2154a3dbfc9e1f Author: Xi Ruoyao <xry...@mengyan1223.wang> Date: Sat Jul 10 17:46:29 2021 +0800 ipa-devirt: check precision mismatch of enum values [PR101396] We are comparing enum values (in wide_int) to check ODR violation. However, if we compare two wide_int values with different precision, we'll trigger an assert, leading to ICE. With enum-base introduced in C++11, it's easy to sink into this situation. To fix the issue, we need to explicitly check this kind of mismatch, and emit a proper warning message if there is such one. gcc/ PR ipa/101396 * ipa-devirt.c (ipa_odr_read_section): Compare the precision of enum values, and emit a warning if they mismatch. gcc/testsuite/ PR ipa/101396 * g++.dg/lto/pr101396_0.C: New test. * g++.dg/lto/pr101396_1.C: New test.