]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/105726 - adjust array bound heuristic
authorRichard Biener <rguenther@suse.de>
Wed, 25 May 2022 09:49:03 +0000 (11:49 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 15 Jun 2022 09:49:27 +0000 (11:49 +0200)
commit55ea76600843498048158ec08a661fe7f0c7bcb0
tree6dd72a162a40cfdac4b4a001d35304f9eea7a1db
parent67bd68bb0915c27d9aad2edb3a921f66b17e48d0
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  <rguenther@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)
gcc/gimple-ssa-warn-restrict.c
gcc/testsuite/g++.dg/warn/Warray-bounds-27.C [new file with mode: 0644]