This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/17172] New: missing warning message when not -O3 or when use function call


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]