aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-10-11 08:58:29 +0200
committerJakub Jelinek <jakub@redhat.com>2023-10-11 09:09:28 +0200
commite75bf1985fdc9a5d3a307882a9251d8fd6e93def (patch)
tree576302ce3306731df381f969d60f27f65546cf60 /libgcc
parentc41492423140e1573df68d1c98e825ae7593741f (diff)
downloadgcc-e75bf1985fdc9a5d3a307882a9251d8fd6e93def.zip
gcc-e75bf1985fdc9a5d3a307882a9251d8fd6e93def.tar.gz
gcc-e75bf1985fdc9a5d3a307882a9251d8fd6e93def.tar.bz2
tree-ssa-strlen: optimization skips clobbering store [PR111519]
The following testcase is miscompiled, because count_nonzero_bytes incorrectly uses get_strinfo information on a pointer from which an earlier instruction loads SSA_NAME stored at the current instruction. get_strinfo shows a state right before the current store though, so if there are some stores in between the current store and the load, the string length information might have changed. The patch passes around gimple_vuse from the store and punts instead of using strinfo on loads from MEM_REF which have different gimple_vuse from that. 2023-10-11 Richard Biener <rguenther@suse.de> Jakub Jelinek <jakub@redhat.com> PR tree-optimization/111519 * tree-ssa-strlen.cc (strlen_pass::count_nonzero_bytes): Add vuse argument and pass it through to recursive calls and count_nonzero_bytes_addr calls. Don't shadow the stmt argument, but change stmt for gimple_assign_single_p statements for which we don't immediately punt. (strlen_pass::count_nonzero_bytes_addr): Add vuse argument and pass it through to recursive calls and count_nonzero_bytes calls. Don't use get_strinfo if gimple_vuse (stmt) is different from vuse. Don't shadow the stmt argument. * gcc.dg/torture/pr111519.c: New testcase.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions