Commit 02765a37 by Richard Guenther Committed by Richard Biener

fold-const.c (fold_widened_comparison): Do not allow sign-changes that change the result.

2008-04-08  Richard Guenther  <rguenther@suse.de>

	* fold-const.c (fold_widened_comparison): Do not allow
	sign-changes that change the result.

	* gcc.c-torture/execute/20080408-1.c: New testcase.

From-SVN: r134108
parent a0f39282
2008-04-08 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_widened_comparison): Do not allow
sign-changes that change the result.
2008-04-08 Janis Johnson <janis187@us.ibm.com> 2008-04-08 Janis Johnson <janis187@us.ibm.com>
PR target/35839 PR target/35839
......
...@@ -6721,7 +6721,11 @@ fold_widened_comparison (enum tree_code code, tree type, tree arg0, tree arg1) ...@@ -6721,7 +6721,11 @@ fold_widened_comparison (enum tree_code code, tree type, tree arg0, tree arg1)
|| TYPE_UNSIGNED (TREE_TYPE (arg0)) == TYPE_UNSIGNED (shorter_type)) || TYPE_UNSIGNED (TREE_TYPE (arg0)) == TYPE_UNSIGNED (shorter_type))
&& (TREE_TYPE (arg1_unw) == shorter_type && (TREE_TYPE (arg1_unw) == shorter_type
|| (TYPE_PRECISION (shorter_type) || (TYPE_PRECISION (shorter_type)
>= TYPE_PRECISION (TREE_TYPE (arg1_unw))) > TYPE_PRECISION (TREE_TYPE (arg1_unw)))
|| ((TYPE_PRECISION (shorter_type)
== TYPE_PRECISION (TREE_TYPE (arg1_unw)))
&& (TYPE_UNSIGNED (shorter_type)
== TYPE_UNSIGNED (TREE_TYPE (arg1_unw))))
|| (TREE_CODE (arg1_unw) == INTEGER_CST || (TREE_CODE (arg1_unw) == INTEGER_CST
&& (TREE_CODE (shorter_type) == INTEGER_TYPE && (TREE_CODE (shorter_type) == INTEGER_TYPE
|| TREE_CODE (shorter_type) == BOOLEAN_TYPE) || TREE_CODE (shorter_type) == BOOLEAN_TYPE)
......
2008-04-08 Richard Guenther <rguenther@suse.de>
* gcc.c-torture/execute/20080408-1.c: New testcase.
2008-04-08 Eric Botcazou <ebotcazou@adacore.com> 2008-04-08 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/pack6.adb: New test. * gnat.dg/pack6.adb: New test.
extern void abort (void);
int main ()
{
short ssi = 126;
unsigned short usi = 65280;
int fail = !(ssi < usi);
if (fail)
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