[Bug tree-optimization/81384] built-in form of strnlen missing

2018-06-18 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81384

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Martin Sebor  ---
Implemented in r261705.

[Bug tree-optimization/81384] built-in form of strnlen missing

2018-06-18 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81384

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Mon Jun 18 16:32:59 2018
New Revision: 261705

URL: https://gcc.gnu.org/viewcvs?rev=261705&root=gcc&view=rev
Log:
PR tree-optimization/81384 - built-in form of strnlen missing

gcc/ChangeLog:

PR tree-optimization/81384
* builtin-types.def (BT_FN_SIZE_CONST_STRING_SIZE): New.
* builtins.c (expand_builtin_strnlen): New function.
(expand_builtin): Call it.
(fold_builtin_n): Avoid setting TREE_NO_WARNING.
* builtins.def (BUILT_IN_STRNLEN): New.
* calls.c (maybe_warn_nonstring_arg): Handle BUILT_IN_STRNLEN.
Warn for bounds in excess of maximum object size.
* tree-ssa-strlen.c (maybe_set_strlen_range): Return tree representing
single-value ranges.  Handle strnlen.
(handle_builtin_strlen): Handle strnlen.
(strlen_check_and_optimize_stmt): Same.
* doc/extend.texi (Other Builtins): Document strnlen.

gcc/testsuite/ChangeLog:

PR tree-optimization/81384
* gcc.c-torture/execute/builtins/lib/strnlen.c: New test.
* gcc.c-torture/execute/builtins/strnlen-lib.c: New test.
* gcc.c-torture/execute/builtins/strnlen.c: New test.
* gcc.dg/attr-nonstring-2.c: New test.
* gcc.dg/attr-nonstring-3.c: New test.
* gcc.dg/attr-nonstring-4.c: New test.
* gcc.dg/strlenopt-45.c: New test.
* gcc.dg/strlenopt.h (strnlen):  Declare.


Added:
trunk/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strnlen.c
trunk/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen-lib.c
trunk/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c
trunk/gcc/testsuite/gcc.dg/attr-nonstring-2.c
trunk/gcc/testsuite/gcc.dg/attr-nonstring-3.c
trunk/gcc/testsuite/gcc.dg/attr-nonstring-4.c
trunk/gcc/testsuite/gcc.dg/strlenopt-45.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtin-types.def
trunk/gcc/builtins.c
trunk/gcc/builtins.def
trunk/gcc/calls.c
trunk/gcc/doc/extend.texi
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/attr-nonstring-3.c
trunk/gcc/testsuite/gcc.dg/strlenopt.h
trunk/gcc/tree-ssa-strlen.c

[Bug tree-optimization/81384] built-in form of strnlen missing

2018-06-05 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81384

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #2 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2018-06/msg00267.html

[Bug tree-optimization/81384] built-in form of strnlen missing

2018-06-04 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81384

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

[Bug tree-optimization/81384] built-in form of strnlen missing

2017-07-17 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81384

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-07-17
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
Confirmed.

[Bug tree-optimization/81384] built-in form of strnlen missing

2017-07-10 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81384

Martin Sebor  changed:

   What|Removed |Added

   Severity|normal  |enhancement