tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Avoid undesirable warning.
* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Avoid undesirable warning. From-SVN: r267454
This commit is contained in:
parent
766d4a5925
commit
3a03bffd48
@ -1,3 +1,8 @@
|
||||
2018-12-28 Martin Sebor <msebor@redhat.com>
|
||||
|
||||
* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Avoid
|
||||
undesirable warning.
|
||||
|
||||
2018-12-28 Thomas Schwinge <thomas@codesourcery.com>
|
||||
|
||||
* omp-expand.c (expand_omp_target): Restructure OpenACC vs. OpenMP
|
||||
|
@ -2114,6 +2114,13 @@ maybe_diag_stxncpy_trunc (gimple_stmt_iterator gsi, tree src, tree cnt)
|
||||
if (wi::to_wide (dstsize) != cntrange[1])
|
||||
return false;
|
||||
|
||||
/* Avoid warning for strncpy(a, b, N) calls where the following
|
||||
equalities hold:
|
||||
N == sizeof a && N == sizeof b */
|
||||
if (tree srcsize = compute_objsize (src, 1))
|
||||
if (wi::to_wide (srcsize) == cntrange[1])
|
||||
return false;
|
||||
|
||||
if (cntrange[0] == cntrange[1])
|
||||
return warning_at (callloc, OPT_Wstringop_truncation,
|
||||
"%G%qD specified bound %E equals destination size",
|
||||
|
Loading…
Reference in New Issue
Block a user