This is the mail archive of the gcc@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]

Re: Status of GCC memory checking, -fcheck-memory-usage


Post Scriptum: Example:

cat >ex.c <<EOF
#include <stdio.h>
int main(void) {
  char *x;
  scanf("%s",x);
  return 0;
}
EOF

checkergcc -Wall -W -o ex ex.c
./ex
>From Checker (pid:01056): (rus) read uninitialized byte(s) in the
stack.
When Reading 4 byte(s) at address 0xbffffbf8, inside the stack.
Stack frames are:
        pc=0x08048730 in main at ex.c:4
        pc=0x08054f0b in this_main at stubs-main.c:13
        pc=0x4002fa42 in checker_text_stubs_end at stubs/end-stubs.c:7
        pc=0x08048648 in *unknown* at *unknown*:0
>From Checker (pid:01056): (fun) function warning.
scanf: No width field for string.
Stack frames are:
        pc=0x08054ebe in chkr_stub_scanf at stubs-stdio.c:91
        pc=0x08048765 in main at ex.c:4
        pc=0x08054f0b in this_main at stubs-main.c:13
        pc=0x4002fa42 in checker_text_stubs_end at stubs/end-stubs.c:7
        pc=0x08048648 in *unknown* at *unknown*:0


Not that anyone would intentionally write such code :-)
But it shows the potential of the tool. There's much
more to it than just malloc debugging.

I'm really disappointed that this very nice tool should have to go.

Claus

-- 
Claus Fischer <claus.fischer@clausfischer.com>
http://www.clausfischer.com/


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