diff options
author | Martin Sebor <msebor@redhat.com> | 2020-09-19 17:47:29 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2020-09-19 17:56:13 -0600 |
commit | 3f9a497d1b0dd9da87908a11b59bf364ad40ddca (patch) | |
tree | f1a13f5fcd2db0e36dd3c487b47dd7198151ce56 /gcc/errors.c | |
parent | baad4c48a85a354d2bf1b17e5aff71203c08adea (diff) | |
download | gcc-3f9a497d1b0dd9da87908a11b59bf364ad40ddca.zip gcc-3f9a497d1b0dd9da87908a11b59bf364ad40ddca.tar.gz gcc-3f9a497d1b0dd9da87908a11b59bf364ad40ddca.tar.bz2 |
Extend -Warray-bounds to detect out-of-bounds accesses to array parameters.
gcc/ChangeLog:
PR middle-end/82608
PR middle-end/94195
PR c/50584
PR middle-end/84051
* gimple-array-bounds.cc (get_base_decl): New function.
(get_ref_size): New function.
(trailing_array): New function.
(array_bounds_checker::check_array_ref): Call them. Handle arrays
declared in function parameters.
(array_bounds_checker::check_mem_ref): Same. Handle references to
dynamically allocated arrays.
gcc/testsuite/ChangeLog:
PR middle-end/82608
PR middle-end/94195
PR c/50584
PR middle-end/84051
* c-c++-common/Warray-bounds.c: Adjust.
* gcc.dg/Wbuiltin-declaration-mismatch-9.c: Adjust.
* gcc.dg/Warray-bounds-63.c: New test.
* gcc.dg/Warray-bounds-64.c: New test.
* gcc.dg/Warray-bounds-65.c: New test.
* gcc.dg/Warray-bounds-66.c: New test.
* gcc.dg/Warray-bounds-67.c: New test.
Diffstat (limited to 'gcc/errors.c')
0 files changed, 0 insertions, 0 deletions