diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-07 07:40:01 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-07 07:40:01 +0000 |
commit | 7db628eba650d9d187513c6365fe52e0f588eca9 (patch) | |
tree | 4931bfe9c77a6c8047f0ddbf95b8af43821d7528 /gcc/fold-const.c | |
parent | 790368c5a04247b0ce30c17a79c1c2215f8e16de (diff) | |
download | gcc-7db628eba650d9d187513c6365fe52e0f588eca9.tar.gz |
PR middle-end/36137
* fold-const.c (fold_binary): Use STRIP_SIGN_NOPS instead of
STRIP_NOPS on arguments even for MIN_EXPR and MAX_EXPR.
* gcc.c-torture/execute/20080506-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135028 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b4645ca256e..db7be875427 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1,6 +1,6 @@ /* Fold a constant sub-tree into a single node for C-compiler Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -9261,7 +9261,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) safe for every expression, except for a comparison expression because its signedness is derived from its operands. So, in the latter case, only strip conversions that don't change the - signedness. + signedness. MIN_EXPR/MAX_EXPR also need signedness of arguments + preserved. Note that this is done as an internal manipulation within the constant folder, in order to find the simplest representation @@ -9269,7 +9270,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) cases, the appropriate type conversions should be put back in the tree that will get out of the constant folder. */ - if (kind == tcc_comparison) + if (kind == tcc_comparison || code == MIN_EXPR || code == MAX_EXPR) { STRIP_SIGN_NOPS (arg0); STRIP_SIGN_NOPS (arg1); |