From: Jakub Jelinek Date: Thu, 17 Oct 2019 22:21:12 +0000 (+0200) Subject: re PR tree-optimization/92056 (ice in expr_object_size, at tree-object-si ze.c:675... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=928a7c35ae25f4921611a83b5e7c44d4cdc5e728;p=gcc.git re PR tree-optimization/92056 (ice in expr_object_size, at tree-object-si ze.c:675 with -O3) PR tree-optimization/92056 * tree-ssa-strlen.c (determine_min_objsize): Call init_object_sizes before calling compute_builtin_object_size. * gcc.dg/tree-ssa/pr92056.c: New test. From-SVN: r277134 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ebb7cbcbda9..c137c56fb61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-10-18 Jakub Jelinek + + PR tree-optimization/92056 + * tree-ssa-strlen.c (determine_min_objsize): Call init_object_sizes + before calling compute_builtin_object_size. + 2019-10-17 Iain Sandoe PR target/65342 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 93f15a54705..2d2a2748249 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-18 Jakub Jelinek + + PR tree-optimization/92056 + * gcc.dg/tree-ssa/pr92056.c: New test. + 2019-10-17 Paolo Carlini * g++.old-deja/g++.other/decl9.C: Check locations too. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr92056.c b/gcc/testsuite/gcc.dg/tree-ssa/pr92056.c new file mode 100644 index 00000000000..e43d0c06e2f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr92056.c @@ -0,0 +1,36 @@ +/* PR tree-optimization/92056 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "return 1;" 2 "optimized" } } */ +/* { dg-final { scan-tree-dump-not "strcmp \\(" "optimized" } } */ + +void bar (int, char *); + +int +foo (int x, char *y, const char *z) +{ + char *a; + __builtin_sprintf (y, z); + if (x == 3) + a = __builtin_malloc (5); + else if (x == 7) + a = __builtin_malloc (6); + else + a = __builtin_malloc (7); + bar (x, a); + return __builtin_strcmp (a, "abcdefg") != 0; +} + +int +baz (int x) +{ + char *a; + if (x == 3) + a = __builtin_malloc (5); + else if (x == 7) + a = __builtin_malloc (6); + else + a = __builtin_malloc (7); + bar (x, a); + return __builtin_strcmp (a, "abcdefg") != 0; +} diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 5c229ca7310..d5833f69766 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -3462,6 +3462,8 @@ determine_min_objsize (tree dest) { unsigned HOST_WIDE_INT size = 0; + init_object_sizes (); + if (compute_builtin_object_size (dest, 2, &size)) return size;