re PR middle-end/18921 (wrong code with operator "?")
PR middle-end/18921 * fold-const.c (fold_unwidened_comparison): Use omit_one_operand instead of constant_boolean_node as arg0 may have side-effects. * gcc.dg/pr18921-1.c: New test case. From-SVN: r92030
This commit is contained in:
parent
49e4d5803e
commit
ec7e2228d1
@ -1,3 +1,9 @@
|
||||
2004-12-11 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
PR middle-end/18921
|
||||
* fold-const.c (fold_unwidened_comparison): Use omit_one_operand
|
||||
instead of constant_boolean_node as arg0 may have side-effects.
|
||||
|
||||
2004-12-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
|
||||
|
||||
* pa-host.c (pa_gt_pch_use_address): Use lseek and read to copy PCH
|
||||
|
@ -6023,27 +6023,27 @@ fold_widened_comparison (enum tree_code code, tree type, tree arg0, tree arg1)
|
||||
{
|
||||
case EQ_EXPR:
|
||||
if (above || below)
|
||||
return constant_boolean_node (false, type);
|
||||
return omit_one_operand (type, integer_zero_node, arg0);
|
||||
break;
|
||||
|
||||
case NE_EXPR:
|
||||
if (above || below)
|
||||
return constant_boolean_node (true, type);
|
||||
return omit_one_operand (type, integer_one_node, arg0);
|
||||
break;
|
||||
|
||||
case LT_EXPR:
|
||||
case LE_EXPR:
|
||||
if (above)
|
||||
return constant_boolean_node (true, type);
|
||||
return omit_one_operand (type, integer_one_node, arg0);
|
||||
else if (below)
|
||||
return constant_boolean_node (false, type);;
|
||||
return omit_one_operand (type, integer_zero_node, arg0);
|
||||
|
||||
case GT_EXPR:
|
||||
case GE_EXPR:
|
||||
if (above)
|
||||
return constant_boolean_node (false, type);
|
||||
return omit_one_operand (type, integer_zero_node, arg0);
|
||||
else if (below)
|
||||
return constant_boolean_node (true, type);;
|
||||
return omit_one_operand (type, integer_one_node, arg0);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -1,3 +1,8 @@
|
||||
2004-12-11 Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
PR middle-end/18921
|
||||
* gcc.dg/pr18921-1.c: New test case.
|
||||
|
||||
2004-12-11 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
|
||||
|
||||
PR fortran/17175
|
||||
|
20
gcc/testsuite/gcc.dg/pr18921-1.c
Normal file
20
gcc/testsuite/gcc.dg/pr18921-1.c
Normal file
@ -0,0 +1,20 @@
|
||||
/* PR middle-end/18921 */
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
int foo (int k)
|
||||
{
|
||||
unsigned char j = 0;
|
||||
(k ? 0 : j++) == -1;
|
||||
return j;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
if (!foo (0))
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user