https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103062
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Aldy Hernandez <al...@gcc.gnu.org>: https://gcc.gnu.org/g:bb27f5e9ec3c7ab0f5c859d90c59dd4573b53d97 commit r12-4891-gbb27f5e9ec3c7ab0f5c859d90c59dd4573b53d97 Author: Aldy Hernandez <al...@redhat.com> Date: Thu Nov 4 09:23:24 2021 +0100 Convert arrays in ssa pointer_equiv_analyzer to auto_vec's. The problem in this PR is an off-by-one bug. We should've allocated num_ssa_names + 1. However, in fixing this, I noticed that num_ssa_names can change between queries, so I have replaced the array with an auto_vec and added code to grow the vector as necessary. Tested on x86-64 Linux. PR tree-optimization/103062 gcc/ChangeLog: PR tree-optimization/103062 * value-pointer-equiv.cc (ssa_equiv_stack::ssa_equiv_stack): Increase size of allocation by 1. (ssa_equiv_stack::push_replacement): Grow as needed. (ssa_equiv_stack::get_replacement): Same. (pointer_equiv_analyzer::pointer_equiv_analyzer): Same. (pointer_equiv_analyzer::~pointer_equiv_analyzer): Remove delete. (pointer_equiv_analyzer::set_global_equiv): Grow as needed. (pointer_equiv_analyzer::get_equiv): Same. (pointer_equiv_analyzer::get_equiv_expr): Remove const. * value-pointer-equiv.h (class pointer_equiv_analyzer): Remove const markers. Use auto_vec instead of tree *. gcc/testsuite/ChangeLog: * gcc.dg/pr103062.c: New test.