Bug 94144 - gcc: strange "is used uninitialized" reports
Summary: gcc: strange "is used uninitialized" reports
Status: RESOLVED WONTFIX
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Stable Snapshot 2
Hardware: Other All
: P5 - None : Minor
Target Milestone: ---
Assignee: Michael Matz
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-27 12:26 UTC by Stanislav Brabec
Modified: 2007-06-05 12:35 UTC (History)
0 users

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Brabec 2005-06-27 12:26:43 UTC
Attached code reports following warning:

unused.c: In function ‘main’:
unused.c:14: warning: ‘testvar.unusedval’ is used uninitialized in this function

Uncommenting "forget (testvar)" on line 15, this warning disappears, which is
even more strange.

The warning is invalid (should be "may be used uninitialized"), because gcc has
no knowledge about forget().

Related: http://bugzilla.gnome.org/show_bug.cgi?id=308923

gcc -c -O2 -Wall unused.c
------
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 (testvar);*/
    }
    forget (testarray[0]);
    return 0;
}
Comment 1 Michael Matz 2005-06-27 13:25:50 UTC
Entered as http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22197 . 
Comment 2 Andreas Jaeger 2007-05-03 07:54:18 UTC
Tracked upstream and will end in a future product...

Marking as wontfix for 10.0