public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108780] New: Spurious warning with -ftrivial-auto-var-init=zero
@ 2023-02-13 23:52 trprince at synopsys dot com
2023-02-14 0:03 ` [Bug middle-end/108780] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: trprince at synopsys dot com @ 2023-02-13 23:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108780
Bug ID: 108780
Summary: Spurious warning with -ftrivial-auto-var-init=zero
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: trprince at synopsys dot com
Target Milestone: ---
I encountered the following spurious (or at least, confusing/misleading--note
the variable name) warning on some code after enabling
`-ftrivial-auto-var-init=zero` on one of our codebases. It appears that there
have been similar issues with spurious warnings and
`-ftrivial-auto-var-init=zero` in the past but I was able to reproduce this
with trunk on godbolt:
https://godbolt.org/z/zre74sWq1
$ cat bad.cpp
struct a {
int b();
};
void c() {
a d;
const auto &e(d.b());
}
$ g++ --version
g++ (GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ -ftrivial-auto-var-init=zero -Wuninitialized -c bad.cpp
bad.cpp: In function ‘void c()’:
bad.cpp:6:22: warning: ‘D.2414’ is used uninitialized [-Wuninitialized]
6 | const auto &e(d.b());
| ^
$
I'd be happy to provide any additional context if I'm missing anything.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug middle-end/108780] Spurious warning with -ftrivial-auto-var-init=zero
2023-02-13 23:52 [Bug c++/108780] New: Spurious warning with -ftrivial-auto-var-init=zero trprince at synopsys dot com
@ 2023-02-14 0:03 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-14 0:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108780
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 107411.
*** This bug has been marked as a duplicate of bug 107411 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-14 0:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 23:52 [Bug c++/108780] New: Spurious warning with -ftrivial-auto-var-init=zero trprince at synopsys dot com
2023-02-14 0:03 ` [Bug middle-end/108780] " pinskia 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).