https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116534
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:36de56d3d643e7b8131fa6671b9e85258a1d1ca1 commit r14-10800-g36de56d3d643e7b8131fa6671b9e85258a1d1ca1 Author: Marek Polacek <pola...@redhat.com> Date: Thu Aug 29 10:40:50 2024 -0400 c++: ICE with -Wtautological-compare in template [PR116534] Pre r14-4793, we'd call warn_tautological_cmp -> operand_equal_p with operands wrapped in NON_DEPENDENT_EXPR, which works, since o_e_p bails for codes it doesn't know. But now we pass operands not encapsulated in NON_DEPENDENT_EXPR, and crash, because the template tree for &a[x] has null DECL_FIELD_OFFSET. This patch extends r12-7797 to cover the case when DECL_FIELD_OFFSET is null. PR c++/116534 gcc/ChangeLog: * fold-const.cc (operand_compare::operand_equal_p): If either field's DECL_FIELD_OFFSET is null, compare the fields with ==. gcc/testsuite/ChangeLog: * g++.dg/warn/Wtautological-compare4.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com> (cherry picked from commit 7ca486889b1b1c7e7bcbbca3b6caa103294ec07d)