This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/22197] New: invalid "is" used uninitialized, should be "may be"
- From: "matz at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jun 2005 13:25:18 -0000
- Subject: [Bug middle-end/22197] New: invalid "is" used uninitialized, should be "may be"
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compile this code with -O2 -Wall on 4.0.x or mainline:
-------------------------------------
struct testme {
int testval;
int unusedval;
};
extern void forget (struct testme forgotten);
int main () {
struct testme testarray[1];
struct testme testvar;
testvar.testval = 0;
testarray[0] = testvar;
forget (testarray[0]);
return 0;
}
--------------------------------------
This will give this warning:
unused.c:13: warning: ‘testvar.unusedval’ is used uninitialized in this
function
The problem is the copy of some uninitialized part. Yes, it does copy
something uninitialized, but that's okay, as long as it is not really
accessed. At the very least it should only be a "may be used uninit"
warning. This is only noticed by tree-sra. With -fno-tree-sra there's
no warning. So, in effect, accesses to uninitialized parts for purpose
of copying should not lead to such warning.
--
Summary: invalid "is" used uninitialized, should be "may be"
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: matz at suse dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22197