[Bug middle-end/94195] missing warning reading a smaller object via an lvalue of a larger type
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Sep 19 23:57:40 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94195
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:
https://gcc.gnu.org/g:3f9a497d1b0dd9da87908a11b59bf364ad40ddca
commit r11-3306-g3f9a497d1b0dd9da87908a11b59bf364ad40ddca
Author: Martin Sebor <msebor@redhat.com>
Date: Sat Sep 19 17:47:29 2020 -0600
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.
More information about the Gcc-bugs
mailing list