Bug 17172 - missing warning message when not -O3 or when use function call
missing warning message when not -O3 or when use function call
Status: RESOLVED DUPLICATE of bug 179
Product: gcc
Classification: Unclassified
Component: c
3.4.1
: P2 normal
: 4.0.0
Assigned To: Not yet assigned to anyone
: diagnostic
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-08-24 17:52 UTC by xiaoyi_wu
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: both linux and solaris
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xiaoyi_wu 2004-08-24 17:52:57 UTC
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.
Comment 1 Andrew Pinski 2004-08-24 18:00:54 UTC
Fixed on the mainline already.
Comment 2 Andrew Pinski 2004-08-25 21:16:41 UTC
Reopening to mark as a dup of ..
Comment 3 Andrew Pinski 2004-08-25 21:16:52 UTC

*** This bug has been marked as a duplicate of 179 ***