From: Jakub Jelinek Date: Thu, 17 Oct 2019 07:21:24 +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=0bbb0ca112279e5b6704d1e51b396f0e2a136251;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-object-size.c (cond_expr_object_size): Return early if then_ processing resulted in unknown size. * gcc.c-torture/compile/pr92056.c: New test. From-SVN: r277093 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5fccbd4d1d8..0dd5d8ca839 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-10-17 Jakub Jelinek + PR tree-optimization/92056 + * tree-object-size.c (cond_expr_object_size): Return early if then_ + processing resulted in unknown size. + PR tree-optimization/92115 * tree-ssa-ifcombine.c (ifcombine_ifandif): Force condition into temporary if it could trap. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c79ba7b989a..eb3112d2672 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-10-17 Jakub Jelinek + PR tree-optimization/92056 + * gcc.c-torture/compile/pr92056.c: New test. + PR tree-optimization/92115 * gcc.dg/pr92115.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr92056.c b/gcc/testsuite/gcc.c-torture/compile/pr92056.c new file mode 100644 index 00000000000..d04da763e15 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr92056.c @@ -0,0 +1,18 @@ +/* PR tree-optimization/92056 */ + +const char *d; + +void +foo (int c, char *e, const char *a, const char *b) +{ + switch (c) + { + case 33: + for (;; d++) + if (__builtin_strcmp (b ? : "", d)) + return; + break; + case 4: + __builtin_sprintf (e, a); + } +} diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c index db9b5694e85..6e79bbd1d91 100644 --- a/gcc/tree-object-size.c +++ b/gcc/tree-object-size.c @@ -903,6 +903,9 @@ cond_expr_object_size (struct object_size_info *osi, tree var, gimple *stmt) else expr_object_size (osi, var, then_); + if (object_sizes[object_size_type][varno] == unknown[object_size_type]) + return reexamine; + if (TREE_CODE (else_) == SSA_NAME) reexamine |= merge_object_sizes (osi, var, else_, 0); else