public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56289] New: Bad unused value warning with comma operator
@ 2013-02-11 18:00 thomaseding at gmail dot com
2013-02-11 18:33 ` [Bug c++/56289] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: thomaseding at gmail dot com @ 2013-02-11 18:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289
Bug #: 56289
Summary: Bad unused value warning with comma operator
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: thomaseding@gmail.com
Compile the following with -Wunused-value:
int main () {
int x = 0;
int y = 0;
(void) x, y; /* warning: right operand of comma operator has no effect
[-Wunused-value] */
return 0;
}
This is a bad warning, as casting to void should eliminate the warning for both
x and y.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56289] Bad unused value warning with comma operator
2013-02-11 18:00 [Bug c++/56289] New: Bad unused value warning with comma operator thomaseding at gmail dot com
@ 2013-02-11 18:33 ` pinskia at gcc dot gnu.org
2013-02-11 18:35 ` thomaseding at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-02-11 18:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-02-11 18:32:58 UTC ---
(void) x, y;
You are only casting x to void and not y.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56289] Bad unused value warning with comma operator
2013-02-11 18:00 [Bug c++/56289] New: Bad unused value warning with comma operator thomaseding at gmail dot com
2013-02-11 18:33 ` [Bug c++/56289] " pinskia at gcc dot gnu.org
@ 2013-02-11 18:35 ` thomaseding at gmail dot com
2013-02-11 18:40 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: thomaseding at gmail dot com @ 2013-02-11 18:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289
--- Comment #2 from Thomas <thomaseding at gmail dot com> 2013-02-11 18:35:29 UTC ---
But x was used inside the comma operator.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56289] Bad unused value warning with comma operator
2013-02-11 18:00 [Bug c++/56289] New: Bad unused value warning with comma operator thomaseding at gmail dot com
2013-02-11 18:33 ` [Bug c++/56289] " pinskia at gcc dot gnu.org
2013-02-11 18:35 ` thomaseding at gmail dot com
@ 2013-02-11 18:40 ` pinskia at gcc dot gnu.org
2023-09-07 5:18 ` [Bug c++/56289] Bad location for " gayathri.gottumukkala.27 at gmail dot com
2023-09-07 7:16 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-02-11 18:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-02-11 18:40:06 UTC ---
(In reply to comment #2)
> But x was used inside the comma operator.
It is complaining about the right hand side which is y.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56289] Bad location for unused value warning with comma operator
2013-02-11 18:00 [Bug c++/56289] New: Bad unused value warning with comma operator thomaseding at gmail dot com
` (2 preceding siblings ...)
2013-02-11 18:40 ` pinskia at gcc dot gnu.org
@ 2023-09-07 5:18 ` gayathri.gottumukkala.27 at gmail dot com
2023-09-07 7:16 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: gayathri.gottumukkala.27 at gmail dot com @ 2023-09-07 5:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289
Gayathri Gottumukkala <gayathri.gottumukkala.27 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gayathri.gottumukkala.27@gm
| |ail.com
--- Comment #5 from Gayathri Gottumukkala <gayathri.gottumukkala.27 at gmail dot com> ---
We cannot cast the two variables in single line using void. Instead of that we
have to use void for two variables separately.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/56289] Bad location for unused value warning with comma operator
2013-02-11 18:00 [Bug c++/56289] New: Bad unused value warning with comma operator thomaseding at gmail dot com
` (3 preceding siblings ...)
2023-09-07 5:18 ` [Bug c++/56289] Bad location for " gayathri.gottumukkala.27 at gmail dot com
@ 2023-09-07 7:16 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-07 7:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Gayathri Gottumukkala from comment #5)
> We cannot cast the two variables in single line using void.
That's not what the code is trying to do.
> Instead of that
> we have to use void for two variables separately.
Saying "if you don't write the code that triggers the bug, it doesn't trigger
the bug" is not very useful.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-07 7:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11 18:00 [Bug c++/56289] New: Bad unused value warning with comma operator thomaseding at gmail dot com
2013-02-11 18:33 ` [Bug c++/56289] " pinskia at gcc dot gnu.org
2013-02-11 18:35 ` thomaseding at gmail dot com
2013-02-11 18:40 ` pinskia at gcc dot gnu.org
2023-09-07 5:18 ` [Bug c++/56289] Bad location for " gayathri.gottumukkala.27 at gmail dot com
2023-09-07 7:16 ` redi 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).