[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

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

Martin Sebor  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #15 from Martin Sebor  ---
*** Bug 86128 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

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

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #14 from Martin Liška  ---
Fixed.

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

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

--- Comment #13 from Martin Liška  ---
Author: marxin
Date: Mon Jun 11 11:47:00 2018
New Revision: 261434

URL: https://gcc.gnu.org/viewcvs?rev=261434=gcc=rev
Log:
Fix typo done in MPX removal (PR tree-optimization/86089).

2018-06-11  Martin Liska  

PR tree-optimization/86089
* tree-ssa-strlen.c (get_string_length): Move back removed hunk.
2018-06-11  Martin Liska  

PR tree-optimization/86089
* gcc.dg/tree-ssa/pr86089.c: New test.

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

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

2018-06-11 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86089

--- Comment #12 from Jürgen Reuter  ---
(In reply to Martin Liška from comment #11)
> Patch candidate sent here:
> https://gcc.gnu.org/ml/gcc-patches/2018-06/msg00546.html

Thanks for the patch, Martin. I checked that our code works again also with
this (extended) patch including the check on the number of gimple arguments.

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

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

--- Comment #11 from Martin Liška  ---
Patch candidate sent here:
https://gcc.gnu.org/ml/gcc-patches/2018-06/msg00546.html

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

2018-06-11 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86089

--- Comment #10 from Jürgen Reuter  ---
I can confirm that re-introducing the line 
case BUILT_IN_STRCPY_CHK:
in lines 619/20 in tree-ssa-strlen.c does indeed solve this problem and also
the problem (ICE) with our code reported in PR86103.

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

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

--- Comment #9 from Martin Liška  ---
*** Bug 86103 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

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

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #8 from Martin Liška  ---
Sorry for the breakage. Thanks Martin for the analysis. Let me send a patch.

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

2018-06-10 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86089

--- Comment #7 from Jürgen Reuter  ---
Ah I see, so when Martin Liska removed the MPX-support in r261304 you removed
too much from the tree-ssa-strlen.c file? Then a rather fast fix is hopefully
possible.

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

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

Martin Sebor  changed:

   What|Removed |Added

 Status|WAITING |NEW
 CC||marxin at gcc dot gnu.org

--- Comment #6 from Martin Sebor  ---
Thanks for the dump.  I can confirm the iCE with the simplified test case
below.  It's caused by a typo in r261304 in the hunk below.  The
BUILT_IN_STRCPY_CHK case needs to stay:

@@ -628,16 +617,8 @@ get_string_length (strinfo *si)
  lhs = NULL_TREE;
  /* FALLTHRU */
case BUILT_IN_STRCPY:
-   case BUILT_IN_STRCPY_CHK:
-   case BUILT_IN_STRCPY_CHKP:
-   case BUILT_IN_STRCPY_CHK_CHKP:
  gcc_assert (builtin_decl_implicit_p (BUILT_IN_STPCPY));
- if (gimple_call_num_args (stmt) == (with_bounds ? 4 : 2))
-   fn = builtin_decl_implicit (BUILT_IN_STPCPY);
- else
-   fn = builtin_decl_explicit (BUILT_IN_STPCPY_CHK);
- if (with_bounds)
-   fn = chkp_maybe_create_clone (fn)->decl;
+ fn = builtin_decl_implicit (BUILT_IN_STPCPY);
  gcc_assert (lhs == NULL_TREE);
  if (dump_file && (dump_flags & TDF_DETAILS) != 0)
{

$ cat pr86089.c && gcc -O2 -S -Wall pr86089.c
extern char* stpcpy (char*, const char*);

int f (char* s)
{
  char a[32];

  __builtin___strcpy_chk (a, s, __builtin_object_size (a, 1));

  return __builtin_strlen (a);
}
during GIMPLE pass: strlen
pr86089.c: In function ‘f’:
pr86089.c:3:5: internal compiler error: in get_string_length, at
tree-ssa-strlen.c:653
 int f (char* s)
 ^
0x1233bb5 get_string_length
/ssd/src/gcc/git-svn/gcc/tree-ssa-strlen.c:653
0x1235343 handle_builtin_strlen
/ssd/src/gcc/git-svn/gcc/tree-ssa-strlen.c:1190
0x123bd1c strlen_check_and_optimize_stmt
/ssd/src/gcc/git-svn/gcc/tree-ssa-strlen.c:3330
0x123d4b3 strlen_dom_walker::before_dom_children(basic_block_def*)
/ssd/src/gcc/git-svn/gcc/tree-ssa-strlen.c:3683
0x1b3cea3 dom_walker::walk(basic_block_def*)
/ssd/src/gcc/git-svn/gcc/domwalk.c:353
0x123d744 execute
/ssd/src/gcc/git-svn/gcc/tree-ssa-strlen.c:3763
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

2018-06-10 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86089

--- Comment #5 from Jürgen Reuter  ---
And this is the assembler code when executing -S -O1 (cf. below), while for the
-O2
version the compilation leads to an assembler file showing only the .text line:
.text
.globl _hoo
_hoo:
LFB1:
subq$40, %rsp
LCFI0:
movq%rdi, %rsi
movq%rsp, %rdi
movl$32, %edx
call___strcpy_chk
addq$40, %rsp
LCFI1:
ret
LFE1:
.section
__TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EH_frame1:
.set L$set$0,LECIE1-LSCIE1
.long L$set$0
LSCIE1:
.long   0
.byte   0x1
.ascii "zR\0"
.byte   0x1
.byte   0x78
.byte   0x10
.byte   0x1
.byte   0x10
.byte   0xc
.byte   0x7
.byte   0x8
.byte   0x90
.byte   0x1
.align 3
LECIE1:
LSFDE1:
.set L$set$1,LEFDE1-LASFDE1
.long L$set$1
LASFDE1:
.long   LASFDE1-EH_frame1
.quad   LFB1-.
.set L$set$2,LFE1-LFB1
.quad L$set$2
.byte   0
.byte   0x4
.set L$set$3,LCFI0-LFB1
.long L$set$3
.byte   0xe
.byte   0x30
.byte   0x4
.set L$set$4,LCFI1-LCFI0
.long L$set$4
.byte   0xe
.byte   0x8
.align 3
LEFDE1:
.subsections_via_symbols

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

2018-06-10 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86089

--- Comment #4 from Jürgen Reuter  ---
This is the dump-tree-original file, which is produced despite of the ICE, and
which is identical for -O1 and -O2:

;; Function __sputc (null)
;; enabled by -tree-original


{
  if ( --_p->_w >= 0 || _p->_w >= _p->_lbfsize && (signed char) _c != 10)
{
  return (int) (*_p->_p++  = (unsigned char) _c);
}
  else
{
  return __swbuf (_c, _p);
}
}


;; Function hoo (null)
;; enabled by -tree-original


{
  int slen;
  char file[32];

int slen;
char file[32];
  __builtin___strcpy_chk ((char *) , (const char *) in,
__builtin_object_size ((const void *) , 1));
  slen = (int) strlen ((const char *) );
  __builtin___sprintf_chk ((char *)  + (sizetype) slen, 0,
__builtin_object_size ((const void *)  + (sizetype) slen, 1), (const char
*) "1.out");
}

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

2018-06-10 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86089

--- Comment #3 from Jürgen Reuter  ---
I can definitely confirm this problem. Works with -O0 and -O1. Fails with -O2.

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

2018-06-10 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86089

Jürgen Reuter  changed:

   What|Removed |Added

 CC||juergen.reuter at desy dot de

--- Comment #2 from Jürgen Reuter  ---
Possible duplicate: PR86103.

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

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

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2018-06-09
 CC||msebor at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Sebor  ---
I cannot reproduce an ICE with a native Linux compiler or with an
x86_64-apple-darwin17 cross-compiler so there's probably something in the
Darwin headers that triggers it.  Can you please attach a preprocessing
translation unit?

Line 653 has the following code:

   651  /* BUILT_IN_CALLOC always has si->nonzero_chars set.  */
   652  default:
   653gcc_unreachable ();
   654break;
   655  }
   656  }
   657  
   658return si->nonzero_chars;
   659  }

[Bug tree-optimization/86089] [9 Regression] ICE in get_string_length, at tree-ssa-strlen.c:653

2018-06-08 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86089

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
  Component|c   |tree-optimization
   Target Milestone|--- |9.0
Summary|ICE in get_string_length,   |[9 Regression] ICE in
   |at tree-ssa-strlen.c:653|get_string_length, at
   ||tree-ssa-strlen.c:653