public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52523] New: Missing "uninitialized" warning in simple code
@ 2012-03-07 20:21 andreac at unstable dot it
2012-03-08 0:06 ` [Bug tree-optimization/52523] " manu at gcc dot gnu.org
2021-03-25 22:29 ` [Bug tree-optimization/52523] Missing "uninitialized" warning (VOP, taking address of var) msebor at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: andreac at unstable dot it @ 2012-03-07 20:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52523
Bug #: 52523
Summary: Missing "uninitialized" warning in simple code
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: andreac@unstable.it
Compiling this code:
#include <iostream>
int main()
{
int x;
std::cout << x;
std::cin >> x;
}
with g++ -Wall uninitialized.cc
give no warning.
But compiling this code:
#include <iostream>
int main()
{
int x;
std::cout << x;
}
with g++ -Wall uninitialized.cc
gives:
uninitialized.cc: In function ‘int main()’:
uninitialized.cc:6:17: warning: ‘x’ is used uninitialized in this function
[-Wuninitialized
Tested also on version 4.6.1 and 4.6.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/52523] Missing "uninitialized" warning in simple code
2012-03-07 20:21 [Bug tree-optimization/52523] New: Missing "uninitialized" warning in simple code andreac at unstable dot it
@ 2012-03-08 0:06 ` manu at gcc dot gnu.org
2021-03-25 22:29 ` [Bug tree-optimization/52523] Missing "uninitialized" warning (VOP, taking address of var) msebor at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu.org @ 2012-03-08 0:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52523
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-03-08
CC| |manu at gcc dot gnu.org
Blocks| |24639
Ever Confirmed|0 |1
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-03-08 00:05:22 UTC ---
The SSA dump is a bit obscure to me:
int main() ()
{
int x;
int D.21721;
int x.0;
<bb 2>:
[pr52523.cc : 5:17] x.0_1 = x;
[pr52523.cc : 5:17] std::basic_ostream<char>::operator<< ([pr52523.cc : 5]
&cout, x.0_1);
<bb 3>:
[pr52523.cc : 6:16] std::basic_istream<char>::operator>> ([pr52523.cc : 6]
&cin, &x);
<bb 4>:
x ={v} {CLOBBER};
[pr52523.cc : 7:1] D.21721_2 = 0;
<L0>:
[pr52523.cc : 7:1] return D.21721_2;
<L1>:
x ={v} {CLOBBER};
resx 1
}
but I guess that 'std::cin >> x' creates a VOP, and the warning machinery does
not work well with VOPs. See PR19430.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/52523] Missing "uninitialized" warning (VOP, taking address of var)
2012-03-07 20:21 [Bug tree-optimization/52523] New: Missing "uninitialized" warning in simple code andreac at unstable dot it
2012-03-08 0:06 ` [Bug tree-optimization/52523] " manu at gcc dot gnu.org
@ 2021-03-25 22:29 ` msebor at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-25 22:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52523
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gcc dot gnu.org
Status|NEW |RESOLVED
Keywords| |diagnostic
Resolution|--- |FIXED
Target Milestone|--- |11.0
Known to fail| |10.2.0, 4.7.0, 4.8.4,
| |4.9.4, 5.5.0, 6.4.0, 7.2.0,
| |8.3.0, 9.1.0
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 11 (since g:b825a22890740f341eae566af27e18e528cd29a7) diagnoses passing an
uninitialized object by const reference by -Wmaybe-uninitialized:
$ g++ -S -Wall pr52523.C
pr52523.C: In function ‘int main()’:
pr52523.C:6:13: warning: ‘x’ is used uninitialized [-Wuninitialized]
6 | std::cout << x;
| ~~~~~~~~~~^~~~
pr52523.C:5:7: note: ‘x’ declared here
5 | int x;
| ^
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-25 22:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-07 20:21 [Bug tree-optimization/52523] New: Missing "uninitialized" warning in simple code andreac at unstable dot it
2012-03-08 0:06 ` [Bug tree-optimization/52523] " manu at gcc dot gnu.org
2021-03-25 22:29 ` [Bug tree-optimization/52523] Missing "uninitialized" warning (VOP, taking address of var) msebor 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).