]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/105969 - FPE with array diagnostics
authorRichard Biener <rguenther@suse.de>
Wed, 15 Jun 2022 08:54:48 +0000 (10:54 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 15 Jun 2022 11:14:58 +0000 (13:14 +0200)
commitedb9330c29fe8a0a0b76df6fafd6a223a4d0e41f
tree26277e1e4b868300d3036ae30c845da550efa9f9
parentf4c3ce32fa54c1aefac0b3a825d8a3f73de95939
tree-optimization/105969 - FPE with array diagnostics

For a [0][0] array we have to be careful when dividing by the element
size which is zero for the outermost dimension.  Luckily the division
is only for an overflow check which is pointless for array size zero.

2022-06-15  Richard Biener  <rguenther@suse.de>

PR tree-optimization/105969
* gimple-ssa-sprintf.cc (get_origin_and_offset_r): Avoid division
by zero in overflow check.

* gcc.dg/pr105969.c: New testcase.
gcc/gimple-ssa-sprintf.cc
gcc/testsuite/gcc.dg/pr105969.c [new file with mode: 0644]