re PR tree-optimization/44748 (ICE: in fold_convert_const_int_from_real, at fold-const.c:1548)

2010-07-02  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/44748
	* tree-ssa-ccp.c (fold_const_aggregate_ref): Properly handle
	the embedded conversion in MEM_REFs.

	* gcc.dg/tree-ssa/ssa-ccp-29.c: New testcase.

From-SVN: r161689
This commit is contained in:
Richard Guenther 2010-07-02 09:14:03 +00:00 committed by Richard Biener
parent 8c7481f253
commit 3fa3983166
4 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2010-07-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44748
* tree-ssa-ccp.c (fold_const_aggregate_ref): Properly handle
the embedded conversion in MEM_REFs.
2010-07-01 López-Ibáñez <manu@gcc.gnu.org>
* reload.c: Include toplev.h.

View File

@ -1,3 +1,8 @@
2010-07-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44748
* gcc.dg/tree-ssa/ssa-ccp-29.c: New testcase.
2010-07-02 Iain Sandoe <iains@gcc.gnu.org>
* objc-obj-c++-shared/next-abi.h: Remove dependency on system

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-ccp2" } */
static double num;
int foo (void)
{
return *(unsigned *)&num;
}
/* { dg-final { scan-tree-dump "return 0;" "ccp2" } } */
/* { dg-final { cleanup-tree-dump "ccp2" } } */

View File

@ -1317,7 +1317,14 @@ fold_const_aggregate_ref (tree t)
if (DECL_P (base)
&& !AGGREGATE_TYPE_P (TREE_TYPE (base))
&& integer_zerop (TREE_OPERAND (t, 1)))
return get_symbol_constant_value (base);
{
tree res = get_symbol_constant_value (base);
if (res
&& !useless_type_conversion_p
(TREE_TYPE (t), TREE_TYPE (res)))
res = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (t), res);
return res;
}
if (!TREE_READONLY (base)
|| TREE_CODE (TREE_TYPE (base)) != ARRAY_TYPE