]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/108164 - undefined overflow with IV vectorization
authorRichard Biener <rguenther@suse.de>
Mon, 19 Dec 2022 13:55:45 +0000 (14:55 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 19 Dec 2022 15:36:21 +0000 (16:36 +0100)
commitec459469f8a75d96a9b26694554efcc900d411de
tree012e28e3a94af892efd782c0002d0dc892507454
parentaa510619f8b650322c113d8593dd57afe6c6f9ae
tree-optimization/108164 - undefined overflow with IV vectorization

vect_update_ivs_after_vectorizer can end up emitting a signed
IV update when the loop body performed an unsigned computation.
The following makes sure to perform that update in the type
of the loop update type to avoid undefined behavior on overflow.

PR tree-optimization/108164
* tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer):
Perform vect_step_op_add update in the appropriate type.

* gcc.dg/pr108164.c: New testcase.
gcc/testsuite/gcc.dg/pr108164.c [new file with mode: 0644]
gcc/tree-vect-loop-manip.cc