]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/109609 - correctly interpret arg size in fnspec
authorRichard Biener <rguenther@suse.de>
Tue, 25 Apr 2023 12:56:44 +0000 (14:56 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 26 Apr 2023 09:35:14 +0000 (11:35 +0200)
commit2c7e89510fe41265b285e886d19f9895adf545e8
tree2dfa22de8c1eac68f80d9b59227f58768342cbfd
parentef6051b36241bf130bf76af0b775248635dc616e
tree-optimization/109609 - correctly interpret arg size in fnspec

By majority vote and a hint from the API name which is
arg_max_access_size_given_by_arg_p this interprets a memory access
size specified as given as other argument such as for strncpy
in the testcase which has "1cO313" as specifying the _maximum_
size read/written rather than the exact size.  There are two
uses interpreting it that way already and one differing.  The
following adjusts the differing and clarifies the documentation.

PR tree-optimization/109609
* attr-fnspec.h (arg_max_access_size_given_by_arg_p):
Clarify semantics.
* tree-ssa-alias.cc (check_fnspec): Correctly interpret
the size given by arg_max_access_size_given_by_arg_p as
maximum, not exact, size.

* gcc.dg/torture/pr109609.c: New testcase.

(cherry picked from commit e8d00353017f895d03a9eabae3506fd126ce1a2d)
gcc/attr-fnspec.h
gcc/testsuite/gcc.dg/torture/pr109609.c [new file with mode: 0644]
gcc/tree-ssa-alias.cc