aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wstringop-overflow-46.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2020-10-09 13:56:53 -0600
committerMartin Sebor <msebor@redhat.com>2020-10-12 09:04:49 -0600
commitde05c19d5fd661ae16dd75a895b49d32d12f5edc (patch)
tree05d9906c75f514094c4320b482f200787a34b9b6 /gcc/testsuite/gcc.dg/Wstringop-overflow-46.c
parent71dbabccbfb295c87d91719fe72d9d60511c0b44 (diff)
downloadgcc-de05c19d5fd661ae16dd75a895b49d32d12f5edc.zip
gcc-de05c19d5fd661ae16dd75a895b49d32d12f5edc.tar.gz
gcc-de05c19d5fd661ae16dd75a895b49d32d12f5edc.tar.bz2
Correct handling of indices into arrays with elements larger than 1 (PR c++/96511)
Resolves: PR c++/96511 - Incorrect -Wplacement-new on POINTER_PLUS into an array with 4-byte elements PR middle-end/96384 - bogus -Wstringop-overflow= storing into multidimensional array with index in range gcc/ChangeLog: PR c++/96511 PR middle-end/96384 * builtins.c (get_range): Return full range of type when neither value nor its range is available. Fail for ranges inverted due to the signedness of offsets. (compute_objsize): Handle more special array members. Handle POINTER_PLUS_EXPR and VIEW_CONVERT_EXPR that come up in front end code. (access_ref::offset_bounded): Define new member function. * builtins.h (access_ref::eval): New data member. (access_ref::offset_bounded): New member function. (access_ref::offset_zero): New member function. (compute_objsize): Declare a new overload. * gimple-array-bounds.cc (array_bounds_checker::check_array_ref): Use enum special_array_member. * tree.c (component_ref_size): Use special_array_member. * tree.h (special_array_member): Define a new type. (component_ref_size): Change signature. gcc/cp/ChangeLog: PR c++/96511 PR middle-end/96384 * init.c (warn_placement_new_too_small): Call builtin_objsize instead of duplicating what it does. gcc/testsuite/ChangeLog: PR c++/96511 PR middle-end/96384 * g++.dg/init/strlen.C: Add expected warning. * g++.dg/warn/Wplacement-new-size-1.C: Relax warnings. * g++.dg/warn/Wplacement-new-size-2.C: Same. * g++.dg/warn/Wplacement-new-size-6.C: Same. * gcc.dg/Warray-bounds-58.c: Adjust * gcc.dg/Wstringop-overflow-37.c: Same. * g++.dg/warn/Wplacement-new-size-7.C: New test.
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wstringop-overflow-46.c')
0 files changed, 0 insertions, 0 deletions