re PR tree-optimization/60849 (bogus comparison result type)

2014-04-17  Richard Biener  <rguenther@suse.de>

	PR middle-end/60849
	* tree-ssa-propagate.c (valid_gimple_rhs_p): Only allow effective
	boolean results for comparisons.

	* g++.dg/opt/pr60849.C: New testcase.

From-SVN: r209469
This commit is contained in:
Richard Biener 2014-04-17 08:13:53 +00:00 committed by Richard Biener
parent 730e78b045
commit 83ad208e2c
4 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-04-17 Richard Biener <rguenther@suse.de>
PR middle-end/60849
* tree-ssa-propagate.c (valid_gimple_rhs_p): Only allow effective
boolean results for comparisons.
2014-04-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/60836

View File

@ -1,3 +1,8 @@
2014-04-17 Richard Biener <rguenther@suse.de>
PR middle-end/60849
* g++.dg/opt/pr60849.C: New testcase.
2014-04-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/60836

View File

@ -0,0 +1,13 @@
// { dg-do compile }
// { dg-options "-O2" }
int g;
extern "C" int isnan ();
void foo(float a) {
int (*xx)(...);
xx = isnan;
if (xx(a))
g++;
}

View File

@ -571,8 +571,14 @@ valid_gimple_rhs_p (tree expr)
/* All constants are ok. */
break;
case tcc_binary:
case tcc_comparison:
if (!INTEGRAL_TYPE_P (TREE_TYPE (expr))
|| (TREE_CODE (TREE_TYPE (expr)) != BOOLEAN_TYPE
&& TYPE_PRECISION (TREE_TYPE (expr)) != 1))
return false;
/* Fallthru. */
case tcc_binary:
if (!is_gimple_val (TREE_OPERAND (expr, 0))
|| !is_gimple_val (TREE_OPERAND (expr, 1)))
return false;