[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2018-01-14 Thread prathamesh3492 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

--- Comment #9 from prathamesh3492 at gcc dot gnu.org ---
Author: prathamesh3492
Date: Sun Jan 14 08:58:58 2018
New Revision: 256657

URL: https://gcc.gnu.org/viewcvs?rev=256657&root=gcc&view=rev
Log:
2018-01-14  Prathamesh Kulkarni  

PR tree-optimization/83501
* gcc.dg/strlenopt-39.c: Restrict to i?86 and x86_64-*-* targets.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/strlenopt-39.c

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2018-01-10 Thread prathamesh3492 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

--- Comment #8 from prathamesh3492 at gcc dot gnu.org ---
Author: prathamesh3492
Date: Thu Jan 11 04:37:48 2018
New Revision: 256475

URL: https://gcc.gnu.org/viewcvs?rev=256475&root=gcc&view=rev
Log:
2018-01-11  Martin Sebor  
Prathamesh Kulkarni  

PR tree-optimization/83501
PR tree-optimization/81703

* tree-ssa-strlen.c (get_string_cst): Rename...
(get_string_len): ...to this.  Handle global constants.
(handle_char_store): Adjust.

testsuite/
* gcc.dg/strlenopt-39.c: New test-case.
* gcc.dg/pr81703.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.dg/pr81703.c
trunk/gcc/testsuite/gcc.dg/strlenopt-39.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-strlen.c

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2018-01-03 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

--- Comment #7 from Martin Sebor  ---
Author: msebor
Date: Wed Jan  3 16:26:49 2018
New Revision: 256181

URL: https://gcc.gnu.org/viewcvs?rev=256181&root=gcc&view=rev
Log:
PR tree-optimization/83501 - strlen(a) not folded after strcpy(a, "...")

gcc/testsuite/ChangeLog:
* c-c++-common/Warray-bounds-3.c: Remove xfail.


Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/Warray-bounds-3.c

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2018-01-03 Thread prathamesh3492 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

prathamesh3492 at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from prathamesh3492 at gcc dot gnu.org ---
Fixed.

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2018-01-03 Thread prathamesh3492 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

--- Comment #5 from prathamesh3492 at gcc dot gnu.org ---
Author: prathamesh3492
Date: Wed Jan  3 16:07:32 2018
New Revision: 256180

URL: https://gcc.gnu.org/viewcvs?rev=256180&root=gcc&view=rev
Log:
2018-01-03  Prathamesh Kulkarni  

PR tree-optimization/83501
* tree-ssa-strlen.c (get_string_cst): New.
(handle_char_store): Call get_string_cst.

testsuite/
* gcc.dg/tree-ssa/pr83501.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr83501.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-strlen.c

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2017-12-20 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

Martin Sebor  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=81703

--- Comment #4 from Martin Sebor  ---
See also bug 81703 for a similar case.

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2017-12-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
This doesn't look safe.  You are ignoring the second operand of the MEM_REF, if
it is non-zero, you'll miscompile stuff.  So, either you need to do it only if
integer_zerop (TREE_OPERAND (rhs, 1)) on the MEM_REF, or need to handle the
offset (if out of bounds for the strlen, ignore it, otherwise adjust the length
accordingly).

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2017-12-20 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

Martin Liška  changed:

   What|Removed |Added

   Target Milestone|--- |8.0

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2017-12-20 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-12-20
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2017-12-19 Thread prathamesh3492 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

prathamesh3492 at gcc dot gnu.org changed:

   What|Removed |Added

 CC||prathamesh3492 at gcc dot 
gnu.org

--- Comment #2 from prathamesh3492 at gcc dot gnu.org ---
Created attachment 42927
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42927&action=edit
Untested fix

[Bug tree-optimization/83501] [8 Regression] strlen(a) not folded after strcpy(a, "...")

2017-12-19 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83501

Martin Sebor  changed:

   What|Removed |Added

   Keywords||missed-optimization
  Known to work||5.4.0, 6.4.0, 7.2.0
  Known to fail||8.0

--- Comment #1 from Martin Sebor  ---
Bisection points to r255197:

2017-11-28  Richard Biener  

PR middle-end/83141
* gimple-fold.c (gimple_fold_builtin_memory_op): For aggregate
copies generated from memcpy use a character array as reference
type.