Commit 48f30f62 by Richard Guenther Committed by Richard Biener

re PR middle-end/42716 (ICE in extract_range_from_assert, at tree-vrp.c:1423)

2010-01-13  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42716
	* fold-const.c (fold_unary_loc): Fold INDIRECT_REFs.

	* gcc.c-torture/compile/pr42716.c: New testcase.

From-SVN: r155859
parent 9e73c690
2010-01-13 Richard Guenther <rguenther@suse.de>
PR middle-end/42716
* fold-const.c (fold_unary_loc): Fold INDIRECT_REFs.
2010-01-13 Jakub Jelinek <jakub@redhat.com> 2010-01-13 Jakub Jelinek <jakub@redhat.com>
PR debug/41371 PR debug/41371
......
...@@ -8942,6 +8942,19 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) ...@@ -8942,6 +8942,19 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0)
} }
return NULL_TREE; return NULL_TREE;
case INDIRECT_REF:
/* Fold *&X to X if X is an lvalue. */
if (TREE_CODE (op0) == ADDR_EXPR)
{
tree op00 = TREE_OPERAND (op0, 0);
if ((TREE_CODE (op00) == VAR_DECL
|| TREE_CODE (op00) == PARM_DECL
|| TREE_CODE (op00) == RESULT_DECL)
&& !TREE_READONLY (op00))
return op00;
}
return NULL_TREE;
default: default:
return NULL_TREE; return NULL_TREE;
} /* switch (code) */ } /* switch (code) */
......
2010-01-13 Richard Guenther <rguenther@suse.de> 2010-01-13 Richard Guenther <rguenther@suse.de>
PR middle-end/42716
* gcc.c-torture/compile/pr42716.c: New testcase.
2010-01-13 Richard Guenther <rguenther@suse.de>
PR lto/42678 PR lto/42678
* gfortran.dg/lto/20100110-1_0.f90: New testcase. * gfortran.dg/lto/20100110-1_0.f90: New testcase.
......
static short foo (long long si1, short si2)
{
return si1 > 0 && si2 > 0 || si1 < 0
&& si2 < 0 && si1 < 1 - si2 ? : si1 + si2;
}
int g_13;
unsigned g_17;
int safe (int, int);
void bar (short p_51, short * p_52)
{
int *const l_55 = &g_13;
if (safe (*p_52, g_13 != foo (*p_52 & *l_55 == g_13 && g_17 >= 1, 0)))
{
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment