re PR c/40172 (Revision 147596 breaks bootstrap)

gcc/

2009-05-17  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/40172
	* c-common.c (warn_logical_operator): Don't warn if one of
	expression isn't always true or false.

gcc/testscase/

2009-05-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR c/40172
	* gcc.dg/pr40172.c: New.

From-SVN: r147639
This commit is contained in:
H.J. Lu 2009-05-17 11:36:44 -07:00
parent 7e361ae60a
commit ae8af5003b
4 changed files with 46 additions and 6 deletions

View File

@ -1,7 +1,13 @@
2009-05-17 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/40172
* c-common.c (warn_logical_operator): Don't warn if one of
expression isn't always true or false.
2009-05-17 Kai Tietz <kai.tietz@onevision.com>
* config/i386/biarch32.h: New file.
* config.gcc: Add for target i386-w64-* the biarch32.h to tm_file.
* config/i386/biarch32.h: New file.
* config.gcc: Add for target i386-w64-* the biarch32.h to tm_file.
2009-05-17 Adam Nemet <anemet@caviumnetworks.com>

View File

@ -1784,10 +1784,8 @@ warn_logical_operator (location_t location, enum tree_code code, tree type,
in0_p = !in0_p, in1_p = !in1_p;
/* If both expressions are the same, if we can merge the ranges, and we
can build the range test, return it or it inverted. If one of the
ranges is always true or always false, consider it to be the same
expression as the other. */
if ((lhs == 0 || rhs == 0 || operand_equal_p (lhs, rhs, 0))
can build the range test, return it or it inverted. */
if (lhs && rhs && operand_equal_p (lhs, rhs, 0)
&& merge_ranges (&in_p, &low, &high, in0_p, low0, high0,
in1_p, low1, high1)
&& 0 != (tem = build_range_check (type,

View File

@ -1,3 +1,8 @@
2009-05-17 H.J. Lu <hongjiu.lu@intel.com>
PR c/40172
* gcc.dg/pr40172.c: New.
2009-05-17 Jason Merrill <jason@redhat.com>
PR c++/40139

View File

@ -0,0 +1,31 @@
/* PR middle-end/40172 */
/* { dg-do compile } */
/* { dg-options "-Wall -W -Werror" } */
struct rtx_def;
typedef struct rtx_def *rtx;
extern int foo;
extern int bar;
extern int xxx;
int
test (void)
{
if (((rtx) 0 != (rtx) 0) && xxx ? foo : bar)
return 1;
else if ((foo & 0) && xxx)
return 2;
else if (foo & 0)
return 3;
else if (0 && xxx)
return 4;
else if (0)
return 5;
if (((int) 0 != (int) 0) && bar ? foo : xxx)
return 6;
else if (0 != 0 && foo ? xxx : bar)
return 7;
else
return 0;
}