https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98029
Bug ID: 98029 Summary: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net Target Milestone: --- With gcc (Debian 20201125-2) 11.0.0 20201125 (experimental) [master revision a4d9837ee4b:97273aee415:b13dacdfb315675803982ad5a3098f7b55e6357a] double f1 (void) { double d; int i; for (d = 2.0, i = 0; i < 5; i++, d *= d) ; return d; } double f2 (void) { volatile double d; int i; for (d = 2.0, i = 0; i < 5; i++, d *= d) ; return d; } yields the following incorrect warning when using "-Wunused-value": tst.c: In function 'f2': tst.c:17:10: warning: right-hand operand of comma expression has no effect [-Wunused-value] 17 | for (d = 2.0, i = 0; i < 5; i++, d *= d) | ~~^~~~~ Note that one gets a warning only for f2. The only difference is the "volatile". I found this when testing GNU MPFR (a similar code occurs in tests/tset_ld.c).