diff options
author | kristerw <kristerw@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-28 16:26:44 +0000 |
---|---|---|
committer | kristerw <kristerw@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-28 16:26:44 +0000 |
commit | de165fbdb1bdff52184d0e433a740a991f2b5386 (patch) | |
tree | c6148dda4b174966d7e453ead8ac9abe3a87b666 /gcc/fold-const.c | |
parent | 34203d28b4109d309423f5e1d4c177b3bb9575c7 (diff) | |
download | gcc-de165fbdb1bdff52184d0e433a740a991f2b5386.tar.gz |
2007-07-28 Richard Guenther <rguenther@suse.de>
PR middle-end/32920
* fold-const.c (fold_cond_expr_with_comparison): Convert
operand zero of MIN/MAX_EXPR to correct type.
* gcc.c-torture/compile/pr32920.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127021 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 106aa4d3dd5..c7447b925df 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4958,7 +4958,9 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) build_int_cst (type, 1), 0), OEP_ONLY_CONST)) return pedantic_non_lvalue (fold_build2 (MIN_EXPR, - type, arg1, arg2)); + type, + fold_convert (type, arg1), + arg2)); break; case LE_EXPR: @@ -4970,7 +4972,9 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) build_int_cst (type, 1), 0), OEP_ONLY_CONST)) return pedantic_non_lvalue (fold_build2 (MIN_EXPR, - type, arg1, arg2)); + type, + fold_convert (type, arg1), + arg2)); break; case GT_EXPR: @@ -4982,7 +4986,9 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) build_int_cst (type, 1), 0), OEP_ONLY_CONST)) return pedantic_non_lvalue (fold_build2 (MAX_EXPR, - type, arg1, arg2)); + type, + fold_convert (type, arg1), + arg2)); break; case GE_EXPR: @@ -4994,7 +5000,9 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) build_int_cst (type, 1), 0), OEP_ONLY_CONST)) return pedantic_non_lvalue (fold_build2 (MAX_EXPR, - type, arg1, arg2)); + type, + fold_convert (type, arg1), + arg2)); break; case NE_EXPR: break; |