public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/55873] New: Missed trivial uninitialized use warning
@ 2013-01-04 11:38 steven at gcc dot gnu.org
2013-01-04 11:46 ` [Bug middle-end/55873] " rguenth at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: steven at gcc dot gnu.org @ 2013-01-04 11:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55873
Bug #: 55873
Summary: Missed trivial uninitialized use warning
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: steven@gcc.gnu.org
extern int foo (int);
int foo (int c)
{
int res;
if (c)
res = 0;
return res;
}
res may be used uninitialized if c==0, but the function is "optimized" to
"return 0" before the uninit1 warning pass runs.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/55873] Missed trivial uninitialized use warning
2013-01-04 11:38 [Bug middle-end/55873] New: Missed trivial uninitialized use warning steven at gcc dot gnu.org
@ 2013-01-04 11:46 ` rguenth at gcc dot gnu.org
2013-01-05 12:11 ` manu at gcc dot gnu.org
2013-01-05 12:16 ` manu at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-04 11:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55873
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WONTFIX
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-04 11:46:06 UTC ---
It's conditionally uninitialized and thus only warned in late uninit pass.
This is a known issue of optimistic constant propagation.
Duplicate of PRxyz. Never going to be fixed.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/55873] Missed trivial uninitialized use warning
2013-01-04 11:38 [Bug middle-end/55873] New: Missed trivial uninitialized use warning steven at gcc dot gnu.org
2013-01-04 11:46 ` [Bug middle-end/55873] " rguenth at gcc dot gnu.org
@ 2013-01-05 12:11 ` manu at gcc dot gnu.org
2013-01-05 12:16 ` manu at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2013-01-05 12:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55873
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-01-05 12:10:56 UTC ---
PR18501, the most frequently reported Wuninitialized bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/55873] Missed trivial uninitialized use warning
2013-01-04 11:38 [Bug middle-end/55873] New: Missed trivial uninitialized use warning steven at gcc dot gnu.org
2013-01-04 11:46 ` [Bug middle-end/55873] " rguenth at gcc dot gnu.org
2013-01-05 12:11 ` manu at gcc dot gnu.org
@ 2013-01-05 12:16 ` manu at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2013-01-05 12:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55873
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-01-05 12:15:35 UTC ---
PR18501, the most frequently reported Wuninitialized bug.
Of course, it is possible to fix it. Clang does warn:
pr18501.c:5:7: warning: variable 'res' is used uninitialized whenever 'if'
condition is false [-Wsometimes-uninitialized]
if (c)
^
pr18501.c:7:10: note: uninitialized use occurs here
return res;
^~~
pr18501.c:5:3: note: remove the 'if' if its condition is always true
if (c)
^~~~~~
pr18501.c:4:10: note: initialize the variable 'res' to silence this warning
int res;
^
= 0
1 warning generated.
It is just that it probably needs some serious amount of work.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-05 12:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-04 11:38 [Bug middle-end/55873] New: Missed trivial uninitialized use warning steven at gcc dot gnu.org
2013-01-04 11:46 ` [Bug middle-end/55873] " rguenth at gcc dot gnu.org
2013-01-05 12:11 ` manu at gcc dot gnu.org
2013-01-05 12:16 ` manu 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).