+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
|| 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. */
--- /dev/null
+// 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
+}