]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/99947 - avoid v.safe_push (v[0])
authorRichard Biener <rguenther@suse.de>
Wed, 7 Apr 2021 08:02:07 +0000 (10:02 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 7 Apr 2021 08:04:20 +0000 (10:04 +0200)
commitd11bcbe166c03f722c0e0d41d6e87ac445758fba
tree23413b5a15b53a95a2811f0c43f328ead9f7545a
parent6eaf7ac6f49eae85825be185005338ca5c886161
tree-optimization/99947 - avoid v.safe_push (v[0])

This avoids (again) the C++ pitfall of pushing a reference to
sth being reallocated.

2021-04-07  Richard Biener  <rguenther@suse.de>

PR tree-optimization/99947
* tree-vect-loop.c (vectorizable_induction): Pre-allocate
steps vector to avoid pushing elements from the reallocated
vector.

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