c++: Implement P2327R1 - De-deprecating volatile compound operations

Message ID YvogbpWyLiQwZ3Yb@tucnak
State New, archived
Headers
Series c++: Implement P2327R1 - De-deprecating volatile compound operations |

Commit Message

Jakub Jelinek Aug. 15, 2022, 10:31 a.m. UTC
  Hi!

From what I can see, this has been voted in as a DR and as it means
we warn less often than before in -std={gnu,c}++2{0,3} modes or with
-Wvolatile, I wonder if it shouldn't be backported to affected release
branches as well.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2022-08-15  Jakub Jelinek  <jakub@redhat.com>

	* typeck.cc (cp_build_modify_expr): Implement
	P2327R1 - De-deprecating volatile compound operations.  Don't warn
	for |=, &= or ^= with volatile lhs.
	* expr.cc (mark_use) <case MODIFY_EXPR>: Adjust warning wording,
	leave out simple.

	* g++.dg/cpp2a/volatile1.C: Adjust for de-deprecation of volatile
	compound |=, &= and ^= operations.
	* g++.dg/cpp2a/volatile3.C: Likewise.
	* g++.dg/cpp2a/volatile5.C: Likewise.


	Jakub
  

Comments

Marek Polacek Aug. 15, 2022, 12:29 p.m. UTC | #1
On Mon, Aug 15, 2022 at 12:31:10PM +0200, Jakub Jelinek wrote:
> Hi!
> 
> From what I can see, this has been voted in as a DR and as it means
> we warn less often than before in -std={gnu,c}++2{0,3} modes or with
> -Wvolatile, I wonder if it shouldn't be backported to affected release
> branches as well.

I'd say so.
 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Can't approve but LGTM.

> 2022-08-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* typeck.cc (cp_build_modify_expr): Implement
> 	P2327R1 - De-deprecating volatile compound operations.  Don't warn
> 	for |=, &= or ^= with volatile lhs.
> 	* expr.cc (mark_use) <case MODIFY_EXPR>: Adjust warning wording,
> 	leave out simple.
> 
> 	* g++.dg/cpp2a/volatile1.C: Adjust for de-deprecation of volatile
> 	compound |=, &= and ^= operations.
> 	* g++.dg/cpp2a/volatile3.C: Likewise.
> 	* g++.dg/cpp2a/volatile5.C: Likewise.
> 
> --- gcc/cp/typeck.cc.jj	2022-06-17 17:36:19.689107831 +0200
> +++ gcc/cp/typeck.cc	2022-08-14 11:14:15.368316963 +0200
> @@ -9136,10 +9136,14 @@ cp_build_modify_expr (location_t loc, tr
>  
>  	  /* An expression of the form E1 op= E2.  [expr.ass] says:
>  	     "Such expressions are deprecated if E1 has volatile-qualified
> -	     type."  We warn here rather than in cp_genericize_r because
> +	     type and op is not one of the bitwise operators |, &, ^."
> +	     We warn here rather than in cp_genericize_r because
>  	     for compound assignments we are supposed to warn even if the
>  	     assignment is a discarded-value expression.  */
> -	  if (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype))
> +	  if (modifycode != BIT_AND_EXPR
> +	      && modifycode != BIT_IOR_EXPR
> +	      && modifycode != BIT_XOR_EXPR
> +	      && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype)))
>  	    warning_at (loc, OPT_Wvolatile,
>  			"compound assignment with %<volatile%>-qualified left "
>  			"operand is deprecated");
> --- gcc/cp/expr.cc.jj	2022-06-27 11:18:02.268063761 +0200
> +++ gcc/cp/expr.cc	2022-08-14 11:41:37.555649422 +0200
> @@ -220,7 +220,7 @@ mark_use (tree expr, bool rvalue_p, bool
>      case MODIFY_EXPR:
>  	{
>  	  tree lhs = TREE_OPERAND (expr, 0);
> -	  /* [expr.ass] "A simple assignment whose left operand is of
> +	  /* [expr.ass] "An assignment whose left operand is of
>  	     a volatile-qualified type is deprecated unless the assignment
>  	     is either a discarded-value expression or appears in an
>  	     unevaluated context."  */
> @@ -230,7 +230,7 @@ mark_use (tree expr, bool rvalue_p, bool
>  	      && !TREE_THIS_VOLATILE (expr))
>  	    {
>  	      if (warning_at (location_of (expr), OPT_Wvolatile,
> -			      "using value of simple assignment with "
> +			      "using value of assignment with "
>  			      "%<volatile%>-qualified left operand is "
>  			      "deprecated"))
>  		/* Make sure not to warn about this assignment again.  */
> --- gcc/testsuite/g++.dg/cpp2a/volatile1.C.jj	2020-07-28 15:39:10.013756159 +0200
> +++ gcc/testsuite/g++.dg/cpp2a/volatile1.C	2022-08-14 11:46:42.721626890 +0200
> @@ -56,6 +56,9 @@ fn2 ()
>    vi = i;
>    vi = i = 42;
>    i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>    &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>    (vi = 42, 45);
>    (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> @@ -74,8 +77,9 @@ fn2 ()
>    vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>    vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>    vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> -  vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> -  vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
>    vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>    vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>    vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> @@ -131,7 +135,8 @@ void raccoon ()
>    volatile T t, u;
>    t = 42;
>    u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> -  t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
>  }
>  
>  void
> --- gcc/testsuite/g++.dg/cpp2a/volatile3.C.jj	2020-01-12 11:54:37.149402305 +0100
> +++ gcc/testsuite/g++.dg/cpp2a/volatile3.C	2022-08-14 11:47:05.691324132 +0200
> @@ -57,6 +57,9 @@ fn2 ()
>    vi = i;
>    vi = i = 42;
>    i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> +  i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
> +  i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
> +  i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
>    &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>    (vi = 42, 45);
>    (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> @@ -75,8 +78,9 @@ fn2 ()
>    vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>    vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>    vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> -  vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> -  vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
>    vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>    vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>    vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> @@ -132,7 +136,8 @@ void raccoon ()
>    volatile T t, u;
>    t = 42;
>    u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> -  t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> +  t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> +  t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
>  }
>  
>  void
> --- gcc/testsuite/g++.dg/cpp2a/volatile5.C.jj	2021-02-08 19:07:33.110166905 +0100
> +++ gcc/testsuite/g++.dg/cpp2a/volatile5.C	2022-08-14 11:42:47.779723765 +0200
> @@ -8,8 +8,8 @@ f (bool b)
>  {
>    (b ? x : y) = 1;
>    (b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } }
> -  z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
> -  ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
> -  (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
> -  (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
> +  z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
> +  ((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
> +  (b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
> +  (b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
>  }
> 
> 	Jakub
> 

Marek
  
Jason Merrill Aug. 15, 2022, 7:57 p.m. UTC | #2
On 8/15/22 03:31, Jakub Jelinek wrote:
> 
>  From what I can see, this has been voted in as a DR and as it means
> we warn less often than before in -std={gnu,c}++2{0,3} modes or with
> -Wvolatile, I wonder if it shouldn't be backported to affected release
> branches as well.

If people are complaining about it on release branches, sure.

> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

> 2022-08-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* typeck.cc (cp_build_modify_expr): Implement
> 	P2327R1 - De-deprecating volatile compound operations.  Don't warn
> 	for |=, &= or ^= with volatile lhs.
> 	* expr.cc (mark_use) <case MODIFY_EXPR>: Adjust warning wording,
> 	leave out simple.
> 
> 	* g++.dg/cpp2a/volatile1.C: Adjust for de-deprecation of volatile
> 	compound |=, &= and ^= operations.
> 	* g++.dg/cpp2a/volatile3.C: Likewise.
> 	* g++.dg/cpp2a/volatile5.C: Likewise.
> 
> --- gcc/cp/typeck.cc.jj	2022-06-17 17:36:19.689107831 +0200
> +++ gcc/cp/typeck.cc	2022-08-14 11:14:15.368316963 +0200
> @@ -9136,10 +9136,14 @@ cp_build_modify_expr (location_t loc, tr
>   
>   	  /* An expression of the form E1 op= E2.  [expr.ass] says:
>   	     "Such expressions are deprecated if E1 has volatile-qualified
> -	     type."  We warn here rather than in cp_genericize_r because
> +	     type and op is not one of the bitwise operators |, &, ^."
> +	     We warn here rather than in cp_genericize_r because
>   	     for compound assignments we are supposed to warn even if the
>   	     assignment is a discarded-value expression.  */
> -	  if (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype))
> +	  if (modifycode != BIT_AND_EXPR
> +	      && modifycode != BIT_IOR_EXPR
> +	      && modifycode != BIT_XOR_EXPR
> +	      && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype)))
>   	    warning_at (loc, OPT_Wvolatile,
>   			"compound assignment with %<volatile%>-qualified left "
>   			"operand is deprecated");
> --- gcc/cp/expr.cc.jj	2022-06-27 11:18:02.268063761 +0200
> +++ gcc/cp/expr.cc	2022-08-14 11:41:37.555649422 +0200
> @@ -220,7 +220,7 @@ mark_use (tree expr, bool rvalue_p, bool
>       case MODIFY_EXPR:
>   	{
>   	  tree lhs = TREE_OPERAND (expr, 0);
> -	  /* [expr.ass] "A simple assignment whose left operand is of
> +	  /* [expr.ass] "An assignment whose left operand is of
>   	     a volatile-qualified type is deprecated unless the assignment
>   	     is either a discarded-value expression or appears in an
>   	     unevaluated context."  */
> @@ -230,7 +230,7 @@ mark_use (tree expr, bool rvalue_p, bool
>   	      && !TREE_THIS_VOLATILE (expr))
>   	    {
>   	      if (warning_at (location_of (expr), OPT_Wvolatile,
> -			      "using value of simple assignment with "
> +			      "using value of assignment with "
>   			      "%<volatile%>-qualified left operand is "
>   			      "deprecated"))
>   		/* Make sure not to warn about this assignment again.  */
> --- gcc/testsuite/g++.dg/cpp2a/volatile1.C.jj	2020-07-28 15:39:10.013756159 +0200
> +++ gcc/testsuite/g++.dg/cpp2a/volatile1.C	2022-08-14 11:46:42.721626890 +0200
> @@ -56,6 +56,9 @@ fn2 ()
>     vi = i;
>     vi = i = 42;
>     i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>     &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>     (vi = 42, 45);
>     (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> @@ -74,8 +77,9 @@ fn2 ()
>     vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>     vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>     vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> -  vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> -  vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
>     vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>     vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
>     vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> @@ -131,7 +135,8 @@ void raccoon ()
>     volatile T t, u;
>     t = 42;
>     u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> -  t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
> +  t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
>   }
>   
>   void
> --- gcc/testsuite/g++.dg/cpp2a/volatile3.C.jj	2020-01-12 11:54:37.149402305 +0100
> +++ gcc/testsuite/g++.dg/cpp2a/volatile3.C	2022-08-14 11:47:05.691324132 +0200
> @@ -57,6 +57,9 @@ fn2 ()
>     vi = i;
>     vi = i = 42;
>     i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> +  i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
> +  i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
> +  i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
>     &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>     (vi = 42, 45);
>     (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> @@ -75,8 +78,9 @@ fn2 ()
>     vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>     vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>     vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> -  vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> -  vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
> +  vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
>     vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>     vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
>     vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> @@ -132,7 +136,8 @@ void raccoon ()
>     volatile T t, u;
>     t = 42;
>     u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> -  t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> +  t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
> +  t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
>   }
>   
>   void
> --- gcc/testsuite/g++.dg/cpp2a/volatile5.C.jj	2021-02-08 19:07:33.110166905 +0100
> +++ gcc/testsuite/g++.dg/cpp2a/volatile5.C	2022-08-14 11:42:47.779723765 +0200
> @@ -8,8 +8,8 @@ f (bool b)
>   {
>     (b ? x : y) = 1;
>     (b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } }
> -  z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
> -  ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
> -  (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
> -  (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
> +  z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
> +  ((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
> +  (b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
> +  (b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
>   }
> 
> 	Jakub
>
  

Patch

--- gcc/cp/typeck.cc.jj	2022-06-17 17:36:19.689107831 +0200
+++ gcc/cp/typeck.cc	2022-08-14 11:14:15.368316963 +0200
@@ -9136,10 +9136,14 @@  cp_build_modify_expr (location_t loc, tr
 
 	  /* An expression of the form E1 op= E2.  [expr.ass] says:
 	     "Such expressions are deprecated if E1 has volatile-qualified
-	     type."  We warn here rather than in cp_genericize_r because
+	     type and op is not one of the bitwise operators |, &, ^."
+	     We warn here rather than in cp_genericize_r because
 	     for compound assignments we are supposed to warn even if the
 	     assignment is a discarded-value expression.  */
-	  if (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype))
+	  if (modifycode != BIT_AND_EXPR
+	      && modifycode != BIT_IOR_EXPR
+	      && modifycode != BIT_XOR_EXPR
+	      && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype)))
 	    warning_at (loc, OPT_Wvolatile,
 			"compound assignment with %<volatile%>-qualified left "
 			"operand is deprecated");
--- gcc/cp/expr.cc.jj	2022-06-27 11:18:02.268063761 +0200
+++ gcc/cp/expr.cc	2022-08-14 11:41:37.555649422 +0200
@@ -220,7 +220,7 @@  mark_use (tree expr, bool rvalue_p, bool
     case MODIFY_EXPR:
 	{
 	  tree lhs = TREE_OPERAND (expr, 0);
-	  /* [expr.ass] "A simple assignment whose left operand is of
+	  /* [expr.ass] "An assignment whose left operand is of
 	     a volatile-qualified type is deprecated unless the assignment
 	     is either a discarded-value expression or appears in an
 	     unevaluated context."  */
@@ -230,7 +230,7 @@  mark_use (tree expr, bool rvalue_p, bool
 	      && !TREE_THIS_VOLATILE (expr))
 	    {
 	      if (warning_at (location_of (expr), OPT_Wvolatile,
-			      "using value of simple assignment with "
+			      "using value of assignment with "
 			      "%<volatile%>-qualified left operand is "
 			      "deprecated"))
 		/* Make sure not to warn about this assignment again.  */
--- gcc/testsuite/g++.dg/cpp2a/volatile1.C.jj	2020-07-28 15:39:10.013756159 +0200
+++ gcc/testsuite/g++.dg/cpp2a/volatile1.C	2022-08-14 11:46:42.721626890 +0200
@@ -56,6 +56,9 @@  fn2 ()
   vi = i;
   vi = i = 42;
   i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+  i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+  i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+  i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
   &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
   (vi = 42, 45);
   (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
@@ -74,8 +77,9 @@  fn2 ()
   vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
   vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
   vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
-  vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
-  vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+  vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+  vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+  vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
   vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
   vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
   vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
@@ -131,7 +135,8 @@  void raccoon ()
   volatile T t, u;
   t = 42;
   u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
-  t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+  t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+  t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
 }
 
 void
--- gcc/testsuite/g++.dg/cpp2a/volatile3.C.jj	2020-01-12 11:54:37.149402305 +0100
+++ gcc/testsuite/g++.dg/cpp2a/volatile3.C	2022-08-14 11:47:05.691324132 +0200
@@ -57,6 +57,9 @@  fn2 ()
   vi = i;
   vi = i = 42;
   i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+  i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
+  i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
+  i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" }
   &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
   (vi = 42, 45);
   (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
@@ -75,8 +78,9 @@  fn2 ()
   vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
   vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
   vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
-  vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
-  vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+  vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+  vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
+  vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
   vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
   vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
   vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
@@ -132,7 +136,8 @@  void raccoon ()
   volatile T t, u;
   t = 42;
   u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
-  t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+  t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" }
+  t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" }
 }
 
 void
--- gcc/testsuite/g++.dg/cpp2a/volatile5.C.jj	2021-02-08 19:07:33.110166905 +0100
+++ gcc/testsuite/g++.dg/cpp2a/volatile5.C	2022-08-14 11:42:47.779723765 +0200
@@ -8,8 +8,8 @@  f (bool b)
 {
   (b ? x : y) = 1;
   (b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } }
-  z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
-  ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
-  (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
-  (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } }
+  z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+  ((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+  (b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
+  (b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } }
 }