Commit 700ad580 by Richard Kenner

(range_test): Don't convert hi_cst or lo_cst to unsigned when folding

signed range tests.

From-SVN: r11768
parent 84c7be4b
...@@ -2617,15 +2617,21 @@ range_test (jcode, type, lo_code, hi_code, var, lo_cst, hi_cst) ...@@ -2617,15 +2617,21 @@ range_test (jcode, type, lo_code, hi_code, var, lo_cst, hi_cst)
if (! TREE_UNSIGNED (utype)) if (! TREE_UNSIGNED (utype))
{ {
utype = unsigned_type (utype); utype = unsigned_type (utype);
var = convert (utype, var); return fold (convert (type,
lo_cst = convert (utype, lo_cst); build (rcode, utype,
hi_cst = convert (utype, hi_cst); convert (utype,
build (MINUS_EXPR, TREE_TYPE (var),
var, lo_cst)),
convert (utype,
const_binop (MINUS_EXPR, hi_cst,
lo_cst, 0)))));
} }
else
return fold (convert (type, return fold (convert (type,
build (rcode, utype, build (rcode, utype,
build (MINUS_EXPR, utype, var, lo_cst), build (MINUS_EXPR, utype, var, lo_cst),
const_binop (MINUS_EXPR, hi_cst, lo_cst, 0)))); const_binop (MINUS_EXPR, hi_cst,
lo_cst, 0))));
} }
/* Subroutine for fold_truthop: C is an INTEGER_CST interpreted as a P /* Subroutine for fold_truthop: C is an INTEGER_CST interpreted as a P
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment