Commit 4f968d93 by Hartmut Penner Committed by Richard Henderson

fold-const.c (make_range): Only narrow to signed range if the signed range is…

fold-const.c (make_range): Only narrow to signed range if the signed range is smaller than the unsigned range.

        * fold-const.c (make_range): Only narrow to signed range if
        the signed range is smaller than the unsigned range.

	* gcc.c-torture/execute/20020911-1.c: New.

From-SVN: r57050
parent d0c97db6
2002-09-11 Hartmut Penner <hpenner@de.ibm.com>
* fold-const.c (make_range): Only narrow to signed range if
the signed range is smaller than the unsigned range.
2002-09-12 Alan Modra <amodra@bigpond.net.au> 2002-09-12 Alan Modra <amodra@bigpond.net.au>
* emit-rtl.c (set_mem_size): New function. * emit-rtl.c (set_mem_size): New function.
......
...@@ -3089,9 +3089,10 @@ make_range (exp, pin_p, plow, phigh) ...@@ -3089,9 +3089,10 @@ make_range (exp, pin_p, plow, phigh)
= TYPE_MAX_VALUE (equiv_type) ? TYPE_MAX_VALUE (equiv_type) = TYPE_MAX_VALUE (equiv_type) ? TYPE_MAX_VALUE (equiv_type)
: TYPE_MAX_VALUE (type); : TYPE_MAX_VALUE (type);
high_positive = fold (build (RSHIFT_EXPR, type, if (TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (exp)))
convert (type, high_positive), high_positive = fold (build (RSHIFT_EXPR, type,
convert (type, integer_one_node))); convert (type, high_positive),
convert (type, integer_one_node)));
/* If the low bound is specified, "and" the range with the /* If the low bound is specified, "and" the range with the
range for which the original unsigned value will be range for which the original unsigned value will be
......
extern void abort (void);
unsigned short c = 0x8000;
int main()
{
if ((c-0x8000) < 0 || (c-0x8000) > 0x7fff)
abort();
return 0;
}
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