public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]"
@ 2020-11-27 12:09 vincent-gcc at vinc17 dot net
2020-11-27 13:12 ` [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144 marxin at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2020-11-27 12:09 UTC (permalink / raw)
To: gcc-bugs
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).
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144
2020-11-27 12:09 [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" vincent-gcc at vinc17 dot net
@ 2020-11-27 13:12 ` marxin at gcc dot gnu.org
2020-11-28 22:26 ` uecker at eecs dot berkeley.edu
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-27 13:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98029
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |marxin at gcc dot gnu.org
Summary|volatile triggers incorrect |[11 Regression] volatile
|"warning: right-hand |triggers incorrect
|operand of comma expression |"warning: right-hand
|has no effect |operand of comma expression
|[-Wunused-value]" |has no effect
| |[-Wunused-value]" since
| |r11-5188-g32934a4f45a72144
Ever confirmed|0 |1
Last reconfirmed| |2020-11-27
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r11-5188-g32934a4f45a72144.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144
2020-11-27 12:09 [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" vincent-gcc at vinc17 dot net
2020-11-27 13:12 ` [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144 marxin at gcc dot gnu.org
@ 2020-11-28 22:26 ` uecker at eecs dot berkeley.edu
2020-12-07 12:45 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: uecker at eecs dot berkeley.edu @ 2020-11-28 22:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98029
Martin Uecker <uecker at eecs dot berkeley.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |uecker at eecs dot berkeley.edu
--- Comment #2 from Martin Uecker <uecker at eecs dot berkeley.edu> ---
It seems with the changes to lvalue conversion the code
volatile int x;
int i;
(x = 1, i = 2);
gets rewritten to
((x = 1, 1), i = 2)
and then build_compound_expr introduces the spurious warning.
There is a another possible related issue:
volatile int x;
(x, 0);
warns about
warning: variable ‘x’ set but not used
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144
2020-11-27 12:09 [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" vincent-gcc at vinc17 dot net
2020-11-27 13:12 ` [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144 marxin at gcc dot gnu.org
2020-11-28 22:26 ` uecker at eecs dot berkeley.edu
@ 2020-12-07 12:45 ` rguenth at gcc dot gnu.org
2020-12-22 23:49 ` muecker at gwdg dot de
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-12-07 12:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98029
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144
2020-11-27 12:09 [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" vincent-gcc at vinc17 dot net
` (2 preceding siblings ...)
2020-12-07 12:45 ` rguenth at gcc dot gnu.org
@ 2020-12-22 23:49 ` muecker at gwdg dot de
2020-12-23 8:05 ` muecker at gwdg dot de
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: muecker at gwdg dot de @ 2020-12-22 23:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98029
--- Comment #3 from Martin Uecker <muecker at gwdg dot de> ---
It seems this does not happen anymore after fixing PR98047.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144
2020-11-27 12:09 [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" vincent-gcc at vinc17 dot net
` (3 preceding siblings ...)
2020-12-22 23:49 ` muecker at gwdg dot de
@ 2020-12-23 8:05 ` muecker at gwdg dot de
2020-12-23 11:12 ` marxin at gcc dot gnu.org
2021-01-04 21:55 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: muecker at gwdg dot de @ 2020-12-23 8:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98029
--- Comment #4 from Martin Uecker <muecker at gwdg dot de> ---
PATCH https://gcc.gnu.org/pipermail/gcc-patches/2020-December/562465.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144
2020-11-27 12:09 [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" vincent-gcc at vinc17 dot net
` (4 preceding siblings ...)
2020-12-23 8:05 ` muecker at gwdg dot de
@ 2020-12-23 11:12 ` marxin at gcc dot gnu.org
2021-01-04 21:55 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-23 11:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98029
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
I can confirm that.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144
2020-11-27 12:09 [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" vincent-gcc at vinc17 dot net
` (5 preceding siblings ...)
2020-12-23 11:12 ` marxin at gcc dot gnu.org
@ 2021-01-04 21:55 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-04 21:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98029
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <uecker@gcc.gnu.org>:
https://gcc.gnu.org/g:a000eb5918e09d28838ef572f4eea924d32db09b
commit r11-6450-ga000eb5918e09d28838ef572f4eea924d32db09b
Author: Martin Uecker <muecker@gwdg.de>
Date: Mon Jan 4 22:53:58 2021 +0100
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-01-04 21:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 12:09 [Bug c/98029] New: volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" vincent-gcc at vinc17 dot net
2020-11-27 13:12 ` [Bug c/98029] [11 Regression] volatile triggers incorrect "warning: right-hand operand of comma expression has no effect [-Wunused-value]" since r11-5188-g32934a4f45a72144 marxin at gcc dot gnu.org
2020-11-28 22:26 ` uecker at eecs dot berkeley.edu
2020-12-07 12:45 ` rguenth at gcc dot gnu.org
2020-12-22 23:49 ` muecker at gwdg dot de
2020-12-23 8:05 ` muecker at gwdg dot de
2020-12-23 11:12 ` marxin at gcc dot gnu.org
2021-01-04 21:55 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).