re PR c++/19355 (ICE: tree check at c-common.c:2332)

PR c++/19355
	* c-common.c (c_common_truthvalue_conversion): TRUTH_NOT_EXPR is a
	unary operator and can't be treated as a binary/comparison operator.

	* g++.dg/expr/pr19355-1.C: New test case.

From-SVN: r93159
This commit is contained in:
Roger Sayle 2005-01-10 23:55:33 +00:00 committed by Roger Sayle
parent 316e72f2dd
commit 18d002058e
4 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2005-01-10 Roger Sayle <roger@eyesopen.com>
PR c++/19355
* c-common.c (c_common_truthvalue_conversion): TRUTH_NOT_EXPR is a
unary operator and can't be treated as a binary/comparison operator.
2005-01-10 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (ix86_function_value): Use type_natural_mode.

View File

@ -2326,12 +2326,17 @@ c_common_truthvalue_conversion (tree expr)
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
case TRUTH_XOR_EXPR:
case TRUTH_NOT_EXPR:
if (TREE_TYPE (expr) != truthvalue_type_node)
return build2 (TREE_CODE (expr), truthvalue_type_node,
TREE_OPERAND (expr, 0), TREE_OPERAND (expr, 1));
return expr;
case TRUTH_NOT_EXPR:
if (TREE_TYPE (expr) != truthvalue_type_node)
return build1 (TREE_CODE (expr), truthvalue_type_node,
TREE_OPERAND (expr, 0));
return expr;
case ERROR_MARK:
return expr;

View File

@ -1,3 +1,8 @@
2005-01-10 Roger Sayle <roger@eyesopen.com>
PR c++/19355
* g++.dg/expr/pr19355-1.C: New test case.
2005-01-10 Laurent GUERBY <laurent@guerby.net>
* ada/acats/tests/c4/c456001.a: New from ACATS 2.5L

View File

@ -0,0 +1,11 @@
// PR c++/19355
// { dg-do compile }
typedef bool Boolean;
extern Boolean is_nil ();
void f(void)
{
unsigned int ilen;
if(!((ilen > 0 ? !is_nil () : 1))) {}
}