]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR middle-end/91490 - bogus argument missing terminating nul warning on strlen of...
authormsebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Aug 2019 23:09:26 +0000 (23:09 +0000)
committermsebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Aug 2019 23:09:26 +0000 (23:09 +0000)
commit5e22ce63a2db864dbe067944caf16c8932bb1983
tree12d343894aea62b7964a5f595ddfd3cac40750e6
parent1ed63fa27e195da14af51739a5884a9038b917e5
PR middle-end/91490 - bogus argument missing terminating nul warning on strlen of a flexible array member

gcc/c-family/ChangeLog:

PR middle-end/91490
* c-common.c (braced_list_to_string): Add argument and overload.
Handle flexible length arrays and unions.

gcc/testsuite/ChangeLog:

PR middle-end/91490
* c-c++-common/Warray-bounds-7.c: New test.
* gcc.dg/Warray-bounds-39.c: Expect either -Warray-bounds or
-Wstringop-overflow.
* gcc.dg/strlenopt-78.c: New test.

gcc/ChangeLog:

PR middle-end/91490
* builtins.c (c_strlen): Rename argument and introduce new local.
Set no-warning bit on original argument.
* expr.c (string_constant): Pass argument type to fold_ctor_reference.
Fold empty and zero constructors into empty strings.
* gimple-fold.c (fold_nonarray_ctor_reference): Return a STRING_CST
for missing initializers.
* tree.c (build_string_literal): Handle optional argument.
* tree.h (build_string_literal): Add defaulted argument.
* gimple-ssa-warn-restrict.c (maybe_diag_access_bounds): Check
no-warning bit on original expression.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@274837 138bc75d-0d04-0410-961f-82ee72b054a4
13 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/expr.c
gcc/gimple-fold.c
gcc/gimple-ssa-warn-restrict.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Warray-bounds-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Warray-bounds-39.c
gcc/testsuite/gcc.dg/strlenopt-78.c [new file with mode: 0644]
gcc/tree.c
gcc/tree.h