fold-const.c (fold_comparison): Strip nops inside POINTER_PLUS_EXPR.

2010-08-17  Richard Guenther  <rguenther@suse.de>

	* fold-const.c (fold_comparison): Strip nops inside
	POINTER_PLUS_EXPR.

From-SVN: r163298
This commit is contained in:
Richard Guenther 2010-08-17 09:50:12 +00:00 committed by Richard Biener
parent 470301c5f6
commit 743ad76e9e
2 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-08-17 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_comparison): Strip nops inside
POINTER_PLUS_EXPR.
2010-08-17 Shujing Zhao <pearly.zhao@oracle.com>
PR c/40563

View File

@ -8683,6 +8683,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
else if (TREE_CODE (arg0) == POINTER_PLUS_EXPR)
{
base0 = TREE_OPERAND (arg0, 0);
STRIP_SIGN_NOPS (base0);
if (TREE_CODE (base0) == ADDR_EXPR)
{
base0 = TREE_OPERAND (base0, 0);
@ -8705,6 +8706,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
else if (TREE_CODE (arg1) == POINTER_PLUS_EXPR)
{
base1 = TREE_OPERAND (arg1, 0);
STRIP_SIGN_NOPS (base1);
if (TREE_CODE (base1) == ADDR_EXPR)
{
base1 = TREE_OPERAND (base1, 0);