Commit 1d0804d4 by Jan Hubicka Committed by Jan Hubicka

re PR middle-end/45738 (ICE: tree check: expected var_decl, have debug_expr_decl…

re PR middle-end/45738 (ICE: tree check: expected var_decl, have debug_expr_decl in const_value_known_p, at varpool.c:375)


	PR tree-optimization/45738
	PR tree-optimization/45741
	* expr.c (string_constant): Allow CONST_DECL too;
	check that DECL_INITIAL is set.
	* varpool.c (const_value_known_p): Only look into VAR_DECL
	and CONST_DECL.

	* gcc.c-torture/compile/pr45741.c: New.
	* gfortran.fortran-torture/compile/pr45738.f90: New.

From-SVN: r164602
parent 5642f5d5
2010-09-24 Jan Hubicka <jh@suse.cz>
PR tree-optimization/45738
PR tree-optimization/45741
* expr.c (string_constant): Allow CONST_DECL too;
check that DECL_INITIAL is set.
* varpool.c (const_value_known_p): Only look into VAR_DECL
and CONST_DECL.
2010-09-24 Joseph Myers <joseph@codesourcery.com> 2010-09-24 Joseph Myers <joseph@codesourcery.com>
* common.opt (undef): New. * common.opt (undef): New.
...@@ -9854,12 +9854,14 @@ string_constant (tree arg, tree *ptr_offset) ...@@ -9854,12 +9854,14 @@ string_constant (tree arg, tree *ptr_offset)
*ptr_offset = fold_convert (sizetype, offset); *ptr_offset = fold_convert (sizetype, offset);
return array; return array;
} }
else if (TREE_CODE (array) == VAR_DECL) else if (TREE_CODE (array) == VAR_DECL
|| TREE_CODE (array) == CONST_DECL)
{ {
int length; int length;
/* Variables initialized to string literals can be handled too. */ /* Variables initialized to string literals can be handled too. */
if (!const_value_known_p (array) if (!const_value_known_p (array)
|| !DECL_INITIAL (array)
|| TREE_CODE (DECL_INITIAL (array)) != STRING_CST) || TREE_CODE (DECL_INITIAL (array)) != STRING_CST)
return 0; return 0;
......
2010-09-24 Jan Hubicka <jh@suse.cz>
PR tree-optimization/45738
PR tree-optimization/45741
* gcc.c-torture/compile/pr45741.c: New.
* gfortran.fortran-torture/compile/pr45738.f90: New.
2010-09-24 Joseph Myers <joseph@codesourcery.com> 2010-09-24 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/cpp/undef-opt-1.c: New test. * gcc.dg/cpp/undef-opt-1.c: New test.
......
static const int data[2048];
void foo (void *ptr)
{
__builtin_memcmp (data, ptr, 1);
}
PROGRAM TestInfinite
integer(8) :: bit_pattern_NegInf_i8 = -4503599627370496_8
integer(8) :: i
real(8) :: r
r = transfer(bit_pattern_NegInf_i8_p,r)
i = transfer(r,i)
END PROGRAM TestInfinite
...@@ -367,8 +367,8 @@ const_value_known_p (tree decl) ...@@ -367,8 +367,8 @@ const_value_known_p (tree decl)
{ {
struct varpool_node *vnode; struct varpool_node *vnode;
if (TREE_CODE (decl) == PARM_DECL if (TREE_CODE (decl) != VAR_DECL
|| TREE_CODE (decl) == RESULT_DECL) &&TREE_CODE (decl) != CONST_DECL)
return false; return false;
if (TREE_CODE (decl) == CONST_DECL if (TREE_CODE (decl) == CONST_DECL
......
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