https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96723
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>: https://gcc.gnu.org/g:00cb0f5840795698557731c6e549a5ce99573223 commit r11-2789-g00cb0f5840795698557731c6e549a5ce99573223 Author: David Malcolm <dmalc...@redhat.com> Date: Thu Aug 20 10:00:49 2020 -0400 analyzer: fix infinite recursion ICE on unions [PR96723] Attempts to store sm-state into a union in C++ triggered an infinite recursion when trying to generate a representative tree, due to erroneously trying to use the dtor of the union as a field. Fix it by filtering out non-FIELD_DECLs when walking TYPE_FIELDs in region::get_subregions_for_binding. gcc/analyzer/ChangeLog: PR analyzer/96723 * region-model-manager.cc (region_model_manager::get_field_region): Assert that field is a FIELD_DECL. * region.cc (region::get_subregions_for_binding): In union-handling, filter the TYPE_FIELDS traversal to just FIELD_DECLs. gcc/testsuite/ChangeLog: PR analyzer/96723 * g++.dg/analyzer/pr96723.C: New test.