public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102335] New: gcc misses -Wunused-value
@ 2021-09-14 18:11 vanyacpp at gmail dot com
2021-09-14 18:15 ` [Bug c++/102335] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: vanyacpp at gmail dot com @ 2021-09-14 18:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102335
Bug ID: 102335
Summary: gcc misses -Wunused-value
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vanyacpp at gmail dot com
Target Milestone: ---
struct mytype
{
int memfun [[gnu::pure]] ();
};
void test()
{
mytype x;
x.memfun(); // -Wunused-value
mytype().memfun(); // no -Wunused-value
}
https://godbolt.org/z/vc49jWGqn
The code above contains two usages of a [[gnu::pure]] function with ignored
return value. GCC detect only the first one. I believe the second one deserves
a warning too.
Clang shows a warning on both usages.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102335] gcc misses -Wunused-value
2021-09-14 18:11 [Bug c++/102335] New: gcc misses -Wunused-value vanyacpp at gmail dot com
@ 2021-09-14 18:15 ` pinskia at gcc dot gnu.org
2021-09-14 18:17 ` pinskia at gcc dot gnu.org
2021-09-15 8:03 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-14 18:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102335
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Keywords| |diagnostic
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102335] gcc misses -Wunused-value
2021-09-14 18:11 [Bug c++/102335] New: gcc misses -Wunused-value vanyacpp at gmail dot com
2021-09-14 18:15 ` [Bug c++/102335] " pinskia at gcc dot gnu.org
@ 2021-09-14 18:17 ` pinskia at gcc dot gnu.org
2021-09-15 8:03 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-14 18:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102335
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Internal GCC details:
Most likely because there is a TARGET_EXPR in the IR which causes it to be
considered a side effect:
<<cleanup_point <<< Unknown tree: expr_stmt
(void) mytype::memfun (&TARGET_EXPR <D.2411, {}>) >>>>>;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102335] gcc misses -Wunused-value
2021-09-14 18:11 [Bug c++/102335] New: gcc misses -Wunused-value vanyacpp at gmail dot com
2021-09-14 18:15 ` [Bug c++/102335] " pinskia at gcc dot gnu.org
2021-09-14 18:17 ` pinskia at gcc dot gnu.org
@ 2021-09-15 8:03 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-15 8:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102335
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-09-15
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-15 8:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 18:11 [Bug c++/102335] New: gcc misses -Wunused-value vanyacpp at gmail dot com
2021-09-14 18:15 ` [Bug c++/102335] " pinskia at gcc dot gnu.org
2021-09-14 18:17 ` pinskia at gcc dot gnu.org
2021-09-15 8:03 ` rguenth 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).