Fix location maybe_diag_overlap passes to diagnostics so that diagnostic pragmas...
authorJeff Law <law@redhat.com>
Thu, 5 Mar 2020 21:01:30 +0000 (14:01 -0700)
committerJeff Law <law@redhat.com>
Thu, 5 Mar 2020 21:01:30 +0000 (14:01 -0700)
commit55ace4d14637866466498ed43e02d6f95af98f10
tree0bcdec4218fa6088b63ee2eb78903424aeb38f58
parent3a0e583bf17240e55fee7b490e13753cca52bfe1
Fix location maybe_diag_overlap passes to diagnostics so that diagnostic pragmas work better.

PR tree-optimization/91890
* gimple-ssa-warn-restrict.c (maybe_diag_overlap): Remove LOC argument.
Use gimple_or_expr_nonartificial_location.
(check_bounds_overlap): Drop LOC argument to maybe_diag_access_bounds.
Use gimple_or_expr_nonartificial_location.
* gimple.c (gimple_or_expr_nonartificial_location): New function.
* gimple.h (gimple_or_expr_nonartificial_location): Declare it.
* tree-ssa-strlen.c (maybe_warn_overflow): Use
gimple_or_expr_nonartificial_location.
(maybe_diag_stxncpy_trunc, handle_builtin_stxncpy_strncat): Likewise.
(maybe_warn_pointless_strcmp): Likewise.

* gcc.dg/pragma-diag-8.c: New test.
gcc/ChangeLog
gcc/gimple-ssa-warn-restrict.c
gcc/gimple.c
gcc/gimple.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pragma-diag-8.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c