Commit 38946ea1 by Jason Merrill Committed by Jason Merrill

PR c++/84686 - missing volatile loads.

	* cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.

From-SVN: r258231
parent ac80378f
2018-03-03 Jason Merrill <jason@redhat.com>
PR c++/84686 - missing volatile loads.
* cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
2018-03-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71464
......
......@@ -1063,6 +1063,8 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
|| TREE_TYPE (expr) == error_mark_node)
return error_mark_node;
expr = maybe_undo_parenthesized_ref (expr);
expr = mark_discarded_use (expr);
if (implicit == ICV_CAST)
/* An explicit cast to void avoids all -Wunused-but-set* warnings. */
......
// PR c++/84686
// { dg-additional-options -fdump-tree-gimple }
// { dg-final { scan-tree-dump-times "= i" 10 "gimple" } }
volatile int i;
int main()
{
i; //evaluated (a load is performed)
(i); //unevaluated => the load shall be performed
(void)i; //evaluated (a load is performed)
(void)(i); //unevaluated => the load shall be performed
(void)i; //evaluated (a load is performed)
(void)(i); //unevaluated => the load shall be performed
(i,i); // the two subexpression are evaluated
((i),(i)); // no evaluation, => two loads shall happen
}
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