From: rguenth Date: Fri, 25 Aug 2006 22:01:28 +0000 (+0000) Subject: 2006-08-26 Richard Guenther X-Git-Tag: upstream/4.9.2~53306 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a73dee2badc46ba434883b42e130659e2001041a;p=platform%2Fupstream%2Flinaro-gcc.git 2006-08-26 Richard Guenther PR middle-end/28814 * fold-const.c (fold_binary): Fold temporary to correct type before constructing new comparison. * gcc.dg/torture/pr28814.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116439 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b56d210..c18b80e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-08-26 Richard Guenther + + PR middle-end/28814 + * fold-const.c (fold_binary): Fold temporary to correct + type before constructing new comparison. + 2006-08-25 Fariborz Jahanian PR c/28418 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 277bd32..69db6c2 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10289,7 +10289,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST && 0 != (tem = const_binop (TREE_CODE (arg0) == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR, - arg1, TREE_OPERAND (arg0, 1), 0)) + fold_convert (TREE_TYPE (arg0), arg1), + TREE_OPERAND (arg0, 1), 0)) && ! TREE_CONSTANT_OVERFLOW (tem)) return fold_build2 (code, type, TREE_OPERAND (arg0, 0), tem); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9965dd5..9194e7f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-08-26 Richard Guenther + + PR middle-end/28814 + * gcc.dg/torture/pr28814.c: New testcase. + 2006-08-25 Joseph S. Myers PR c/28418 diff --git a/gcc/testsuite/gcc.dg/torture/pr28814.c b/gcc/testsuite/gcc.dg/torture/pr28814.c new file mode 100644 index 0000000..94bbc74 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr28814.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +struct w49 +{ + union + { + } + value; +}; +f9887 (struct w49 a23040) +{ + unsigned long r9887; + if (((struct structure_type24753 *) (r9887 - 1)) == ((void *) 0)) + { + backtrace ("stalin.sc", 7222, 248274); + } +}