(truthvalue_conversion, case ADDR_EXPR): Don't treat address of

external decl as always nonzero.

From-SVN: r11941
This commit is contained in:
Richard Kenner 1996-05-06 15:41:35 -04:00
parent 2786cbadc7
commit fc0c675f04
1 changed files with 6 additions and 0 deletions

View File

@ -2080,6 +2080,12 @@ truthvalue_conversion (expr)
return real_zerop (expr) ? boolean_false_node : boolean_true_node;
case ADDR_EXPR:
/* If we are taking the address of a external decl, it might be zero
if it is weak, so we cannot optimize. */
if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (expr, 0))) == 'd'
&& DECL_EXTERNAL (TREE_OPERAND (expr, 0)))
break;
if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 0)))
return build (COMPOUND_EXPR, boolean_type_node,
TREE_OPERAND (expr, 0), boolean_true_node);