diff options
author | Martin Sebor <msebor@redhat.com> | 2019-08-30 17:49:17 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2019-08-30 11:49:17 -0600 |
commit | 648af1684557e24e54a67b95b57fae2646cc2b56 (patch) | |
tree | 233e3d85c85e847a57c7720dcdc18a04a2f5d079 /gcc/tree-ssa-strlen.c | |
parent | 5d69df7e9292522d00100b79f84a982359ed8142 (diff) | |
download | gcc-648af1684557e24e54a67b95b57fae2646cc2b56.zip gcc-648af1684557e24e54a67b95b57fae2646cc2b56.tar.gz gcc-648af1684557e24e54a67b95b57fae2646cc2b56.tar.bz2 |
PR middle-end/91599 - GCC does not say where warning is happening
gcc/ChangeLog:
PR middle-end/91599
* tree-ssa-strlen.c (handle_store): Use a fallback location if
the statement doesn't have one.
* gimple-pretty-print.c (percent_G_format): Same.
gcc/testsuite/ChangeLog:
PR middle-end/91599
* gcc.dg/Wstringop-overflow-16.c: New test.
From-SVN: r275211
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r-- | gcc/tree-ssa-strlen.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 7bb5f52..b979320 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -4036,7 +4036,12 @@ handle_store (gimple_stmt_iterator *gsi) if (tree dstsize = compute_objsize (lhs, 1, &decl)) if (compare_tree_int (dstsize, lenrange[2]) < 0) { + /* Fall back on the LHS location if the statement + doesn't have one. */ location_t loc = gimple_nonartificial_location (stmt); + if (loc == UNKNOWN_LOCATION) + loc = tree_nonartificial_location (lhs); + loc = expansion_point_location_if_in_system_header (loc); if (warning_n (loc, OPT_Wstringop_overflow_, lenrange[2], "%Gwriting %u byte into a region of size %E", |