[Bug tree-optimization/86114] [8/9 Regression] ICE in gimple_fold_builtin_strlen with an invalid call to strnlen

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

--- Comment #5 from Martin Sebor  ---
Author: msebor
Date: Wed Jun 13 20:39:50 2018
New Revision: 261569

URL: https://gcc.gnu.org/viewcvs?rev=261569&root=gcc&view=rev
Log:
PR tree-optimization/86114 - ICE in gimple_fold_builtin_strlen with an invalid
call to strnlen

gcc/testsuite/ChangeLog:

PR tree-optimization/86114
* gcc.dg/pr86114.c: New test.

gcc/ChangeLog:

PR tree-optimization/86114
* gimple-fold.c (gimple_fold_builtin_strlen): Only handle LHS
of integer types.
* tree-ssa-strlen.c (maybe_set_strlen_range): Same.


Added:
branches/gcc-8-branch/gcc/testsuite/gcc.dg/pr86114.c
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/gimple-fold.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog
branches/gcc-8-branch/gcc/tree-ssa-strlen.c

[Bug tree-optimization/86114] [8/9 Regression] ICE in gimple_fold_builtin_strlen with an invalid call to strnlen

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

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
Fixed by r261567.

[Bug tree-optimization/86114] [8/9 Regression] ICE in gimple_fold_builtin_strlen with an invalid call to strnlen

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

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Wed Jun 13 20:29:04 2018
New Revision: 261567

URL: https://gcc.gnu.org/viewcvs?rev=261567&root=gcc&view=rev
Log:
PR tree-optimization/86114 - ICE in gimple_fold_builtin_strlen with an invalid
call to strnlen

gcc/testsuite/ChangeLog:

PR tree-optimization/86114
* gcc.dg/pr86114.c: New test.

gcc/ChangeLog:

PR tree-optimization/86114
* gimple-fold.c (gimple_fold_builtin_strlen): Only handle LHS
of integer types.
* tree-ssa-strlen.c (maybe_set_strlen_range): Same.


Added:
trunk/gcc/testsuite/gcc.dg/pr86114.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-fold.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-strlen.c

[Bug tree-optimization/86114] [8/9 Regression] ICE in gimple_fold_builtin_strlen with an invalid call to strnlen

2018-06-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86114

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|--- |8.2

[Bug tree-optimization/86114] [8/9 Regression] ICE in gimple_fold_builtin_strlen with an invalid call to strnlen

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

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

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

[Bug tree-optimization/86114] [8/9 Regression] ICE in gimple_fold_builtin_strlen with an invalid call to strnlen

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

Martin Sebor  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-06-11
  Known to work||7.3.0
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
 Ever confirmed|0   |1
  Known to fail||8.1.0, 9.0

--- Comment #1 from Martin Sebor  ---
The ICE was introduced in r256457:

r256457 | msebor | 2018-01-10 16:40:14 -0500 (Wed, 10 Jan 2018) | 21 lines

PR tree-optimization/83671 - Fix for false positive reported by
-Wstringop-overflow does not work with inlining

gcc/ChangeLog:

PR tree-optimization/83671
* builtins.c (c_strlen): Unconditionally return zero for the empty
string.
Use -Warray-bounds for warnings.
* gimple-fold.c (get_range_strlen): Handle non-constant lengths
for non-constant array indices with COMPONENT_REF, arrays of
arrays, and pointers to arrays.
(gimple_fold_builtin_strlen): Determine and set length range for
non-constant character arrays.