diff options
author | Richard Biener <rguenther@suse.de> | 2021-06-14 09:37:24 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-06-14 11:13:55 +0200 |
commit | 08ce1f4c5091b80b680d15c53a17237544a3cca8 (patch) | |
tree | 921989e2ead403e12865d41574b5b273d17b24e5 /gcc/function-tests.c | |
parent | 44b1502070d770927e001c570ed3c636e7303248 (diff) | |
download | gcc-08ce1f4c5091b80b680d15c53a17237544a3cca8.zip gcc-08ce1f4c5091b80b680d15c53a17237544a3cca8.tar.gz gcc-08ce1f4c5091b80b680d15c53a17237544a3cca8.tar.bz2 |
tree-optimization/101031 - fix strlen opt invalidation logic
strlen opt uses ao_ref_init_from_ptr_and_size to prepare alias
queries to invalidate its knowledge about strings. It constrains
the size using the number of known-nonzero chars and adds one
for a terminating nul - without knowing whether such nul exists
or even fits the object. The latter is now a problem since the
oracle disambiguates an access of size two (as built so) against
a store to a plain char variable (where a terminating nul does not
fit). The fix is to instead increment max_size but leave size to
the number of chars we know are accessed.
2021-06-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/101031
* tree-ssa-strlen.c (maybe_invalidate): Increment max_size
instead of size when accounting for a possibly string
terminating nul.
* gcc.dg/torture/pr101031.c: New testcase.
Diffstat (limited to 'gcc/function-tests.c')
0 files changed, 0 insertions, 0 deletions