C: Add test for incorrect warning for assignment of certain volatile expressions fixed by commit 58a45ce [PR98029]

2021-01-04  Martin Uecker  <muecker@gwdg.de>

gcc/testsuite/
	PR c/98029
	* gcc.dg/pr98029.c: New test.
This commit is contained in:
Martin Uecker 2021-01-04 22:53:58 +01:00
parent f262a35188
commit a000eb5918

View file

@ -0,0 +1,21 @@
/* pr98029 */
/* { dg-do compile } */
/* { dg-options "-Wunused" } */
double f2 (void)
{
volatile double d;
int i;
for (d = 2.0, i = 0; i < 5; i++, d *= d) /* { dg-bogus "right-hand operand of comma expression has no effect" } */
;
return d;
}
int g(void)
{
volatile int x;
(x = 1, (void)1); /* { dg-bogus "right-hand operand of comma expression has no effect" } */
return x;
}