mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-21 15:50:50 +08:00
tree-optimization/107554 - fix ICE in stlen optimization
The following fixes a wrongly typed variable causing an ICE. PR tree-optimization/107554 * tree-ssa-strlen.cc (strlen_pass::count_nonzero_bytes): Use unsigned HOST_WIDE_INT type for the strlen. * gcc.dg/pr107554.c: New testcase. Co-Authored-By: Nikita Voronov <nik_1357@mail.ru>
This commit is contained in:
parent
4b3874d803
commit
81de403745
12
gcc/testsuite/gcc.dg/pr107554.c
Normal file
12
gcc/testsuite/gcc.dg/pr107554.c
Normal file
@ -0,0 +1,12 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -foptimize-strlen" } */
|
||||
|
||||
#define ELEMS 0x40000000
|
||||
|
||||
int a[ELEMS];
|
||||
int b[ELEMS];
|
||||
|
||||
int main()
|
||||
{
|
||||
__builtin_memcpy(a, b, ELEMS*sizeof(int));
|
||||
}
|
@ -4735,7 +4735,7 @@ strlen_pass::count_nonzero_bytes (tree exp, gimple *stmt,
|
||||
|
||||
/* Compute the number of leading nonzero bytes in the representation
|
||||
and update the minimum and maximum. */
|
||||
unsigned n = prep ? strnlen (prep, nbytes) : nbytes;
|
||||
unsigned HOST_WIDE_INT n = prep ? strnlen (prep, nbytes) : nbytes;
|
||||
|
||||
if (n < lenrange[0])
|
||||
lenrange[0] = n;
|
||||
|
Loading…
x
Reference in New Issue
Block a user