Commit 5abe9685 by Richard Guenther Committed by Richard Biener

re PR middle-end/34030 (ICE in in compare_values_warnv, at tree-vrp.c:701)

2007-11-16  Richard Guenther  <rguenther@suse.de>

	PR middle-end/34030
	* fold-const.c (fold_binary): Use correct types for folding
	1 << X & Y to Y >> X & 1.

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

From-SVN: r130238
parent f6dfe2fc
2007-11-16 Richard Guenther <rguenther@suse.de> 2007-11-16 Richard Guenther <rguenther@suse.de>
PR middle-end/34030
* fold-const.c (fold_binary): Use correct types for folding
1 << X & Y to Y >> X & 1.
2007-11-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/33870 PR tree-optimization/33870
* tree.h (struct tree_memory_tag): Add base_for_components flag. * tree.h (struct tree_memory_tag): Add base_for_components flag.
(struct tree_struct_field_tag): Remove nesting_level field. (struct tree_struct_field_tag): Remove nesting_level field.
...@@ -11858,24 +11858,24 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) ...@@ -11858,24 +11858,24 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
tree arg01 = TREE_OPERAND (arg0, 1); tree arg01 = TREE_OPERAND (arg0, 1);
if (TREE_CODE (arg00) == LSHIFT_EXPR if (TREE_CODE (arg00) == LSHIFT_EXPR
&& integer_onep (TREE_OPERAND (arg00, 0))) && integer_onep (TREE_OPERAND (arg00, 0)))
return {
fold_build2 (code, type, tree tem = fold_build2 (RSHIFT_EXPR, TREE_TYPE (arg00),
build2 (BIT_AND_EXPR, TREE_TYPE (arg0), arg01, TREE_OPERAND (arg00, 1));
build2 (RSHIFT_EXPR, TREE_TYPE (arg00), tem = fold_build2 (BIT_AND_EXPR, TREE_TYPE (arg0), tem,
arg01, TREE_OPERAND (arg00, 1)), build_int_cst (TREE_TYPE (arg0), 1));
fold_convert (TREE_TYPE (arg0), return fold_build2 (code, type,
integer_one_node)), fold_convert (TREE_TYPE (arg1), tem), arg1);
arg1); }
else if (TREE_CODE (TREE_OPERAND (arg0, 1)) == LSHIFT_EXPR else if (TREE_CODE (arg01) == LSHIFT_EXPR
&& integer_onep (TREE_OPERAND (TREE_OPERAND (arg0, 1), 0))) && integer_onep (TREE_OPERAND (arg01, 0)))
return {
fold_build2 (code, type, tree tem = fold_build2 (RSHIFT_EXPR, TREE_TYPE (arg01),
build2 (BIT_AND_EXPR, TREE_TYPE (arg0), arg00, TREE_OPERAND (arg01, 1));
build2 (RSHIFT_EXPR, TREE_TYPE (arg01), tem = fold_build2 (BIT_AND_EXPR, TREE_TYPE (arg0), tem,
arg00, TREE_OPERAND (arg01, 1)), build_int_cst (TREE_TYPE (arg0), 1));
fold_convert (TREE_TYPE (arg0), return fold_build2 (code, type,
integer_one_node)), fold_convert (TREE_TYPE (arg1), tem), arg1);
arg1); }
} }
/* If this is an NE or EQ comparison of zero against the result of a /* If this is an NE or EQ comparison of zero against the result of a
......
2007-11-16 Richard Guenther <rguenther@suse.de>
PR middle-end/34030
* gcc.c-torture/compile/pr34030.c: New testcase.
2007-11-16 Paul Thomas <pault@gcc.gnu.org> 2007-11-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34008 PR fortran/34008
int myvar;
int foo(int mynum)
{
if ((((void *)0) == (myvar & ((1U<<0) << mynum))) && (mynum > 0))
return 1;
return 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