diff options
author | Jakub Jelinek <jakub@redhat.com> | 2000-11-21 07:55:42 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2000-11-21 07:55:42 +0100 |
commit | 6b16805ede8c2ea6163d01a61c1a087497d2a769 (patch) | |
tree | 6282616042a48c260b18e20e5cc6553258c6303f /gcc/expr.c | |
parent | cd9c4fee8e232dd32854527f9025fda382e27550 (diff) | |
download | gcc-6b16805ede8c2ea6163d01a61c1a087497d2a769.zip gcc-6b16805ede8c2ea6163d01a61c1a087497d2a769.tar.gz gcc-6b16805ede8c2ea6163d01a61c1a087497d2a769.tar.bz2 |
expr.c (do_compare_and_jump): If op0 was replaced by promoted integer constant, use type of op1 for comparison.
* expr.c (do_compare_and_jump): If op0 was replaced by promoted
integer constant, use type of op1 for comparison.
* g++.old-deja/g++.other/inline17.C: New test.
From-SVN: r37605
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -10054,8 +10054,21 @@ do_compare_and_jump (exp, signed_code, unsigned_code, if_false_label, return; op1 = expand_expr_unaligned (TREE_OPERAND (exp, 1), &align1); + if (TREE_CODE (TREE_OPERAND (exp, 1)) == ERROR_MARK) + return; + type = TREE_TYPE (TREE_OPERAND (exp, 0)); mode = TYPE_MODE (type); + if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST + && (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST + || (GET_MODE_BITSIZE (mode) + > GET_MODE_BITSIZE (TREE_TYPE (TREE_OPERAND (exp, 1)))))) + { + /* op0 might have been replaced by promoted constant, in which + case the type of second argument should be used. */ + type = TREE_TYPE (TREE_OPERAND (exp, 1)); + mode = TYPE_MODE (type); + } unsignedp = TREE_UNSIGNED (type); code = unsignedp ? unsigned_code : signed_code; |