https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116735
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Qing Zhao <qinz...@gcc.gnu.org>: https://gcc.gnu.org/g:9a17e6d03c6ed53e3b2dfd2c3ff9b1066ffa97b9 commit r15-4122-g9a17e6d03c6ed53e3b2dfd2c3ff9b1066ffa97b9 Author: qing zhao <qing.z...@oracle.com> Date: Mon Sep 30 18:29:29 2024 +0000 c: ICE in build_counted_by_ref [PR116735] When handling the counted_by attribute, if the corresponding field doesn't exit, in additiion to issue error, we should also remove the already added non-existing "counted_by" attribute from the field_decl. PR c/116735 gcc/c/ChangeLog: * c-decl.cc (verify_counted_by_attribute): Remove the attribute when error. gcc/testsuite/ChangeLog: * gcc.dg/flex-array-counted-by-9.c: New test.