mirror of git://gcc.gnu.org/git/gcc.git
re PR tree-optimization/88693 (Wrong code since r263018)
PR tree-optimization/88693 * tree-ssa-strlen.c (get_min_string_length): Don't set *full_string_p for STRING_CSTs that don't contain any NUL characters in the first TREE_STRING_LENGTH bytes. * gcc.c-torture/execute/pr88693.c: New test. From-SVN: r267852
This commit is contained in:
parent
0f64d96d93
commit
e17fa93eca
|
|
@ -1,3 +1,10 @@
|
||||||
|
2019-01-11 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR tree-optimization/88693
|
||||||
|
* tree-ssa-strlen.c (get_min_string_length): Don't set *full_string_p
|
||||||
|
for STRING_CSTs that don't contain any NUL characters in the first
|
||||||
|
TREE_STRING_LENGTH bytes.
|
||||||
|
|
||||||
2019-01-11 Alan Modra <amodra@gmail.com>
|
2019-01-11 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
PR 88777
|
PR 88777
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2019-01-11 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR tree-optimization/88693
|
||||||
|
* gcc.c-torture/execute/pr88693.c: New test.
|
||||||
|
|
||||||
2019-01-11 Tamar Christina <tamar.christina@arm.com>
|
2019-01-11 Tamar Christina <tamar.christina@arm.com>
|
||||||
|
|
||||||
* gcc.target/aarch64/advsimd-intrinsics/vector-complex_f16.c: Require neon
|
* gcc.target/aarch64/advsimd-intrinsics/vector-complex_f16.c: Require neon
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
/* PR tree-optimization/88693 */
|
||||||
|
|
||||||
|
__attribute__((noipa)) void
|
||||||
|
foo (char *p)
|
||||||
|
{
|
||||||
|
if (__builtin_strlen (p) != 9)
|
||||||
|
__builtin_abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((noipa)) void
|
||||||
|
quux (char *p)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 100; i++)
|
||||||
|
if (p[i] != 'x')
|
||||||
|
__builtin_abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((noipa)) void
|
||||||
|
qux (void)
|
||||||
|
{
|
||||||
|
char b[100];
|
||||||
|
__builtin_memset (b, 'x', sizeof (b));
|
||||||
|
quux (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((noipa)) void
|
||||||
|
bar (void)
|
||||||
|
{
|
||||||
|
static unsigned char u[9] = "abcdefghi";
|
||||||
|
char b[100];
|
||||||
|
__builtin_memcpy (b, u, sizeof (u));
|
||||||
|
b[sizeof (u)] = 0;
|
||||||
|
foo (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((noipa)) void
|
||||||
|
baz (void)
|
||||||
|
{
|
||||||
|
static unsigned char u[] = { 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r' };
|
||||||
|
char b[100];
|
||||||
|
__builtin_memcpy (b, u, sizeof (u));
|
||||||
|
b[sizeof (u)] = 0;
|
||||||
|
foo (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
qux ();
|
||||||
|
bar ();
|
||||||
|
baz ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -3232,8 +3232,9 @@ get_min_string_length (tree rhs, bool *full_string_p)
|
||||||
|
|
||||||
if (rhs && TREE_CODE (rhs) == STRING_CST)
|
if (rhs && TREE_CODE (rhs) == STRING_CST)
|
||||||
{
|
{
|
||||||
*full_string_p = true;
|
HOST_WIDE_INT len = strlen (TREE_STRING_POINTER (rhs));
|
||||||
return strlen (TREE_STRING_POINTER (rhs));
|
*full_string_p = len < TREE_STRING_LENGTH (rhs);
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue