Commit 8d4a2ff6 by Roger Sayle Committed by Roger Sayle

fold-const.c (non_lvalue): Explicitly list the tree codes that need to be…

fold-const.c (non_lvalue): Explicitly list the tree codes that need to be wrapped by NON_LVALUE_EXPR...


	* fold-const.c (non_lvalue): Explicitly list the tree codes that
	need to be wrapped by NON_LVALUE_EXPR, instead of those that don't.

From-SVN: r82195
parent 15077df5
2002-05-23 Roger Sayle <roger@eyesopen.com>
* fold-const.c (non_lvalue): Explicitly list the tree codes that
need to be wrapped by NON_LVALUE_EXPR, instead of those that don't.
2004-05-23 Joseph S. Myers <jsm@polyomino.org.uk> 2004-05-23 Joseph S. Myers <jsm@polyomino.org.uk>
* doc/gcc.texi, doc/gccint.texi, doc/include/gcc-common.texi: * doc/gcc.texi, doc/gccint.texi, doc/include/gcc-common.texi:
......
...@@ -1993,14 +1993,48 @@ fold_convert (tree type, tree arg) ...@@ -1993,14 +1993,48 @@ fold_convert (tree type, tree arg)
tree tree
non_lvalue (tree x) non_lvalue (tree x)
{ {
/* These things are certainly not lvalues. */ /* We only need to wrap lvalue tree codes. */
if (TREE_CODE (x) == NON_LVALUE_EXPR switch (TREE_CODE (x))
|| TREE_CODE (x) == INTEGER_CST {
|| TREE_CODE (x) == REAL_CST case VAR_DECL:
|| TREE_CODE (x) == STRING_CST case PARM_DECL:
|| TREE_CODE (x) == ADDR_EXPR) case RESULT_DECL:
case LABEL_DECL:
case FUNCTION_DECL:
case SSA_NAME:
case COMPONENT_REF:
case INDIRECT_REF:
case ARRAY_REF:
case BIT_FIELD_REF:
case BUFFER_REF:
case ARRAY_RANGE_REF:
case VTABLE_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
case SAVE_EXPR:
case UNSAVE_EXPR:
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case COMPOUND_EXPR:
case MODIFY_EXPR:
case TARGET_EXPR:
case COND_EXPR:
case BIND_EXPR:
case MIN_EXPR:
case MAX_EXPR:
case RTL_EXPR:
break;
default:
/* Assume the worst for front-end tree codes. */
if ((int)TREE_CODE (x) >= NUM_TREE_CODES)
break;
return x; return x;
}
return build1 (NON_LVALUE_EXPR, TREE_TYPE (x), x); return build1 (NON_LVALUE_EXPR, TREE_TYPE (x), x);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment