Convert -Wrestrict pass to ranger.
authorAldy Hernandez <aldyh@redhat.com>
Mon, 19 Oct 2020 15:03:44 +0000 (17:03 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Tue, 20 Oct 2020 18:46:08 +0000 (20:46 +0200)
commite864d395b4e862cece37abe178e7ebd631b5348b
treee98603a69dac2fbaa26c12802bcca7ab1c702e90
parent495ec0b2aa808a6463b8c24288a1730cbae1cfca
Convert -Wrestrict pass to ranger.

There is one adjustment to a C++ test which now gives a false positive.
After talking with Martin Sebor, we've concluded this is expected.  There
is no way to communicate that libstdc++ allocated objects are always
less than PTRDIFF_MAX.

gcc/ChangeLog:

* calls.c (get_size_range): Adjust to work with ranger.
* calls.h (get_size_range): Add ranger argument to prototype.
* gimple-ssa-warn-restrict.c (class wrestrict_dom_walker): Remove.
(check_call): Pull out of wrestrict_dom_walker into a
static function.
(wrestrict_dom_walker::before_dom_children): Rename to...
(wrestrict_walk): ...this.
(pass_wrestrict::execute): Instantiate ranger.
(class builtin_memref): Add stmt and query fields.
(builtin_access::builtin_access): Add range_query field.
(builtin_memref::builtin_memref): Same.
(builtin_memref::extend_offset_range): Same.
(builtin_access::builtin_access): Make work with ranger.
(wrestrict_dom_walker::check_call): Pull out into...
(check_call): ...here.
(check_bounds_or_overlap): Add range_query argument.
* gimple-ssa-warn-restrict.h (check_bounds_or_overlap):
Add range_query and gimple stmt arguments.

gcc/testsuite/ChangeLog:

* gcc.dg/Wrestrict-22.c: New test.
* g++.dg/torture/pr92421.C: Adjust for ranger.

libstdc++-v3/ChangeLog:

* testsuite/21_strings/basic_string/capacity/1.cc: Pass
-Wno-stringop-overflow to test.
gcc/calls.c
gcc/calls.h
gcc/gimple-ssa-warn-restrict.c
gcc/gimple-ssa-warn-restrict.h
gcc/testsuite/g++.dg/torture/pr92421.C
gcc/testsuite/gcc.dg/Wrestrict-22.c [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/capacity/1.cc