https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115642
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>: https://gcc.gnu.org/g:0c27eade4754c13a54e265e4305182c95be1e441 commit r15-1952-g0c27eade4754c13a54e265e4305182c95be1e441 Author: Marek Polacek <pola...@redhat.com> Date: Tue Jun 25 14:55:08 2024 -0400 c: ICE with invalid sizeof [PR115642] Here we ICE in c_expr_sizeof_expr on an erroneous expr.value. The code checks for expr.value == error_mark_node but here the e_m_n is wrapped in a C_MAYBE_CONST_EXPR. I don't think we should have created such a tree, so let's return earlier in c_cast_expr. PR c/115642 gcc/c/ChangeLog: * c-typeck.cc (c_cast_expr): Return error_mark_node if build_c_cast failed. gcc/testsuite/ChangeLog: * gcc.dg/noncompile/sizeof-1.c: New test.