public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36297] New: false warning: 'variable' may be used uninitialized in this function
@ 2008-05-22 7:45 paskhaver at yahoo dot com
2008-05-22 7:48 ` [Bug c++/36297] " paskhaver at yahoo dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: paskhaver at yahoo dot com @ 2008-05-22 7:45 UTC (permalink / raw)
To: gcc-bugs
The follwoing code generates warning
"warning: 'i' may be used uninitialized in this function"
Code is compiled with "g++ -O1 -Wall -c file.cpp -o file.o"
on x86_64 Fedora Core 6 (2.6.22.9-61.fc6)
with gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)
Changing code in almost any way (like removing destructor) disables the
warning.
class ObjBase {
public:
virtual ~ObjBase() {}
};
class Obj : public ObjBase {
int _c;
public:
Obj(int c) : _c(c){};
};
int _Find(const Obj& key);
inline bool Find(const Obj& key, int& v)
{
static bool flag=true;
if (!flag) {
return false;
}
v=_Find(key);
return true;
}
int f() {
int i;
if (Find(0, i)) {
return i;
}
return 0;
}
int _Find(const Obj& key){return 0;}
--
Summary: false warning: 'variable' may be used uninitialized in
this function
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: paskhaver at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36297
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/36297] false warning: 'variable' may be used uninitialized in this function
2008-05-22 7:45 [Bug c++/36297] New: false warning: 'variable' may be used uninitialized in this function paskhaver at yahoo dot com
@ 2008-05-22 7:48 ` paskhaver at yahoo dot com
2008-05-22 7:48 ` paskhaver at yahoo dot com
2008-05-28 7:47 ` [Bug tree-optimization/36297] " pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: paskhaver at yahoo dot com @ 2008-05-22 7:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paskhaver at yahoo dot com 2008-05-22 07:48 -------
Created an attachment (id=15669)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15669&action=view)
result of -save-temps
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36297
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/36297] false warning: 'variable' may be used uninitialized in this function
2008-05-22 7:45 [Bug c++/36297] New: false warning: 'variable' may be used uninitialized in this function paskhaver at yahoo dot com
2008-05-22 7:48 ` [Bug c++/36297] " paskhaver at yahoo dot com
@ 2008-05-22 7:48 ` paskhaver at yahoo dot com
2008-05-28 7:47 ` [Bug tree-optimization/36297] " pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: paskhaver at yahoo dot com @ 2008-05-22 7:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paskhaver at yahoo dot com 2008-05-22 07:47 -------
Created an attachment (id=15668)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15668&action=view)
result of -save-temps
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36297
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/36297] false warning: 'variable' may be used uninitialized in this function
2008-05-22 7:45 [Bug c++/36297] New: false warning: 'variable' may be used uninitialized in this function paskhaver at yahoo dot com
2008-05-22 7:48 ` [Bug c++/36297] " paskhaver at yahoo dot com
2008-05-22 7:48 ` paskhaver at yahoo dot com
@ 2008-05-28 7:47 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-28 7:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-05-28 07:47 -------
This has been fixed in at least 4.3.0, it might have also been fixed in 4.2.0
also.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c++ |tree-optimization
Keywords| |diagnostic
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36297
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-28 7:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22 7:45 [Bug c++/36297] New: false warning: 'variable' may be used uninitialized in this function paskhaver at yahoo dot com
2008-05-22 7:48 ` [Bug c++/36297] " paskhaver at yahoo dot com
2008-05-22 7:48 ` paskhaver at yahoo dot com
2008-05-28 7:47 ` [Bug tree-optimization/36297] " pinskia at gcc dot gnu dot 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).