This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/17172] New: missing warning message when not -O3 or when use function call
- From: "wxy at kivera dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Aug 2004 17:52:58 -0000
- Subject: [Bug c/17172] New: missing warning message when not -O3 or when use function call
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
source code:
#ifdef CALL
void set(int *id) {
*id = 1;
}
#endif
int main(int argc, char **argv) {
int id;
if (argc > 1) {
#ifdef CALL
set(&id);
#else
id = 1;
#endif
}
return id;
}
end of source code
If compile using
gcc -Wall -O3 test.c
it will warn about 'id' might be used uninitialized.
but compile using
gcc -Wall test.c
or
gcc -Wall -O3 -DCALL test.c
then, no such warning is printed.
I think as long as -Wall is included, it should always warn you.
--
Summary: missing warning message when not -O3 or when use
function call
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wxy at kivera dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: both linux and solaris
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17172