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
This commit is contained in:
Jakub Jelinek 2019-10-17 09:21:24 +02:00 committed by Jakub Jelinek
parent 432b4f729d
commit 0bbb0ca112
4 changed files with 28 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2019-10-17 Jakub Jelinek <jakub@redhat.com>
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.

View File

@ -1,5 +1,8 @@
2019-10-17 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/92056
* gcc.c-torture/compile/pr92056.c: New test.
PR tree-optimization/92115
* gcc.dg/pr92115.c: New test.

View File

@ -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);
}
}

View File

@ -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