From bcb285a0b5a8765d45cf828a175a5d053e2a1e2a Mon Sep 17 00:00:00 2001 From: msebor Date: Thu, 22 Feb 2018 17:35:29 +0000 Subject: PR tree-optimization/84480 - bogus -Wstringop-truncation despite assignment with an inlined string literal gcc/ChangeLog: PR tree-optimization/84480 * gimple-fold.c (gimple_fold_builtin_strcpy): Move warnings to maybe_diag_stxncpy_trunc. Call it. * tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Integrate warnings from gimple_fold_builtin_strcpy. Print inlining stack. (handle_builtin_stxncpy): Print inlining stack. * tree-ssa-strlen.h (maybe_diag_stxncpy_trunc): Declare. gcc/testsuite/ChangeLog: PR tree-optimization/84480 * c-c++-common/Wstringop-truncation.c: Adjust text of expected warnings. * g++.dg/warn/Wstringop-truncation-1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257910 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-strlen.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gcc/tree-ssa-strlen.h (limited to 'gcc/tree-ssa-strlen.h') diff --git a/gcc/tree-ssa-strlen.h b/gcc/tree-ssa-strlen.h new file mode 100644 index 00000000000..1399a7819eb --- /dev/null +++ b/gcc/tree-ssa-strlen.h @@ -0,0 +1,26 @@ +/* Declarations of tree-ssa-strlen API. + + Copyright (C) 2018 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_TREE_SSA_STRLEN_H +#define GCC_TREE_SSA_STRLEN_H + +extern bool maybe_diag_stxncpy_trunc (gimple_stmt_iterator, tree, tree); + +#endif // GCC_TREE_SSA_STRLEN_H -- cgit v1.2.1