https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102513
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |10.3.0, 11.2.0, 12.0 Last reconfirmed| |2021-11-09 CC| |msebor at gcc dot gnu.org Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Summary|False positive |[10.11.12 Regression] Many |-Wstringop-overflow= or |false positive warnings |-Warray-bounds warning with |with recursive function |recursive function | --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed with GCC 10 through 12. Presumably all three warnings are false positives here, including -Waggressive-loop-optimizations. The encode_block.constprop definition shows the first statement that triggers the -Warray-bounds: __attribute__((access ("^0[7]", ))) int encode_block.constprop (int[256] * blk2, unsigned int level) { ... <bb 2> [local count: 118111600]: __builtin_memset (&MEM <int[7][256]> [(void *)&block2 + 4398046509056B], 0, 17179869176); ivtmp.329_244 = (unsigned long) &MEM <int[7][256]> [(void *)&block2 + 1024B]; _157 = (unsigned long) &block2; _46 = _157 + 17179870192; The access to block2 is to the global definition of the array, not the argument (I have renamed the latter to blk2 before producing the dump to avoid confusion). Since block2 is a 2 X 256 matrix the memset access is out of bounds. The warning is doing its job pointing it out. The whole function must be unreachable and shouldn't be emitted.