https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105726
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:55ea76600843498048158ec08a661fe7f0c7bcb0 commit r10-10844-g55ea76600843498048158ec08a661fe7f0c7bcb0 Author: Richard Biener <rguent...@suse.de> Date: Wed May 25 11:49:03 2022 +0200 tree-optimization/105726 - adjust array bound heuristic There's heuristic to detect ptr[1].a[...] out of bound accesses reasoning that if ptr points to an array of aggregates a trailing incomplete array has to have size zero. The following more thoroughly constrains the cases this applies to avoid false positive diagnostics. 2022-05-25 Richard Biener <rguent...@suse.de> PR tree-optimization/105726 * gimple-ssa-warn-restrict.c (builtin_memref::set_base_and_offset): Constrain array-of-flexarray case more. * g++.dg/warn/Warray-bounds-27.C: New testcase. (cherry picked from commit e7c482b08076bb299742883c4ffd65b31e33200c)