> If one wants to look up something in symbol table during late optimization > one is supposed to check that ::get does not return NULL and be conservative > otheriwse. So your change for PR120156 was OK with me, but I did not > explicitly write (sorty for that). Similarly for vectorizer I would simply > test for node to exist.
That's a bit ugly since we test decl_in_symtab_p just before, but of course very safe for release branches (the crash for the Ada testcase is a regression present in GCC 12 and later). Tested on x86-64/Linux, OK for all branches (once they reopen)? * tree-vect-data-refs.cc (vect_can_force_dr_alignment_p): Return false if the variable has no symtab node. -- Eric Botcazou
diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index 9fd1ef29650..6e35f549a8c 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -7242,7 +7242,8 @@ vect_can_force_dr_alignment_p (const_tree decl, poly_uint64 alignment) return false; if (decl_in_symtab_p (decl) - && !symtab_node::get (decl)->can_increase_alignment_p ()) + && (!symtab_node::get (decl) + || !symtab_node::get (decl)->can_increase_alignment_p ())) return false; if (TREE_STATIC (decl))