On Fri, Mar 04, 2016 at 07:19:56PM +0100, Jakub Jelinek wrote: > > --- gcc/c-family/c-common.c > > +++ gcc/c-family/c-common.c > > @@ -11443,6 +11443,10 @@ resolve_overloaded_builtin (location_t loc, tree > > function, > > && orig_code != BUILT_IN_ATOMIC_STORE_N) > > result = sync_resolve_return (first_param, result, orig_format); > > > > + if (fetch_op) > > + /* Prevent -Wunused-value warning. */ > > + TREE_USED (result) = true; > > + > > Can't sync_resolve_return return error_mark_node? > If it could, perhaps it would be saver to move this a few lines above the > sync_resolve_return call, where we've already checked that result is not > error_mark_node.
That seemed right but now I remember why I put setting TREE_USED here. Setting TREE_USED on the result of build_function_call_vec (a CALL_EXPR) wouldn't suppress the warning, it needs to be set on the result of sync_resolve_return (a CONVERT_EXPR). Setting TREE_USED on error_mark_node doesn't ICE so I didn't check for that as I think it should be harmless. So I'm keeping the patch as-is, please let me know you still want to see some adjustments. Marek