builtin-stringop-chk-4.c
19.9 KB
-
PR libstdc++/54924 - Warn for std::string constructor with wrong size · d9c5a8b9
PR libstdc++/54924 - Warn for std::string constructor with wrong size PR middle-end/79234 - warn on past the end reads by library functions gcc/ChangeLog: PR middle-end/79234 * builtins.c (check_sizes): Adjust to handle reading past the end. Avoid printing excessive upper bound of ranges. Use %E to print tree nodes instead of converting them to %wu. (expand_builtin_memchr): New function. (compute_dest_size): Rename... (compute_objsize): ...to this. (expand_builtin_memcpy): Adjust. (expand_builtin_mempcpy): Adjust. (expand_builtin_strcat): Adjust. (expand_builtin_strcpy): Adjust. (check_strncat_sizes): Adjust. (expand_builtin_strncat): Adjust. (expand_builtin_strncpy): Adjust and simplify. (expand_builtin_memset): Adjust. (expand_builtin_bzero): Adjust. (expand_builtin_memcmp): Adjust. (expand_builtin): Handle memcmp. (maybe_emit_chk_warning): Check strncat just once. gcc/testsuite/ChangeLog: PR middle-end/79234 * gcc.dg/builtin-stringop-chk-8.c: New test. * gcc.dg/builtin-stringop-chk-1.c: Adjust. * gcc.dg/builtin-stringop-chk-4.c: Same. * gcc.dg/builtin-strncat-chk-1.c: Same. * g++.dg/ext/strncpy-chk1.C: Same. * g++.dg/torture/Wsizeof-pointer-memaccess1.C: Same. * gcc.dg/out-of-bounds-1.c: Same. * gcc.dg/pr78138.c: Same. * gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Same. * gfortran.dg/mvbits_7.f90: Same. From-SVN: r247622
Martin Sebor committed