summaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-12 13:27:07 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-12 13:27:07 +0000
commit7cb9c999b70de37fc94bcd31110a82f98dd41326 (patch)
treece69281cf285db8a82e42170e80479229135cc7d /gcc/c-typeck.c
parent9978d42455794acbab1680bc0e70406176f9f632 (diff)
downloadgcc-7cb9c999b70de37fc94bcd31110a82f98dd41326.tar.gz
PR bootstrap/43699
* c-typeck.c (c_process_expr_stmt): Call mark_exp_read even for exprs satisfying handled_component_p. * gcc.dg/Wunused-var-7.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158224 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 2296cbe2f93..681c0e42df9 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -8826,11 +8826,13 @@ c_process_expr_stmt (location_t loc, tree expr)
&& warn_unused_value)
emit_side_effect_warnings (loc, expr);
+ if (DECL_P (expr) || handled_component_p (expr))
+ mark_exp_read (expr);
+
/* If the expression is not of a type to which we cannot assign a line
number, wrap the thing in a no-op NOP_EXPR. */
if (DECL_P (expr) || CONSTANT_CLASS_P (expr))
{
- mark_exp_read (expr);
expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
SET_EXPR_LOCATION (expr, loc);
}