Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CODE FOR new ex4.c
- ==================
- #include <stdio.h>
- int main()
- {
- int age = 10;
- int height;
- bad_function();
- printf("I am %d years old.\n");
- printf("I am %d inches tall.\n", height);
- return 0;
- }
- void bad_function()
- {
- int x;
- printf("%d\n", x);
- }
- =====================
- VALGRIND OUTPUT
- =====================
- ==3383== Memcheck, a memory error detector
- ==3383== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
- ==3383== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
- ==3383== Command: ./ex4
- ==3383==
- ==3383== Use of uninitialised value of size 4
- ==3383== at 0x407EB2B: _itoa_word (_itoa.c:195)
- ==3383== by 0x4082E55: vfprintf (vfprintf.c:1619)
- ==3383== by 0x40891DE: printf (printf.c:35)
- ==3383== by 0x80483FB: main (ex4.c:8)
- ==3383==
- ==3383== Conditional jump or move depends on uninitialised value(s)
- ==3383== at 0x407EB33: _itoa_word (_itoa.c:195)
- ==3383== by 0x4082E55: vfprintf (vfprintf.c:1619)
- ==3383== by 0x40891DE: printf (printf.c:35)
- ==3383== by 0x80483FB: main (ex4.c:8)
- ==3383==
- ==3383== Conditional jump or move depends on uninitialised value(s)
- ==3383== at 0x4082C10: vfprintf (vfprintf.c:1619)
- ==3383== by 0x40891DE: printf (printf.c:35)
- ==3383== by 0x80483FB: main (ex4.c:8)
- ==3383==
- ==3383== Conditional jump or move depends on uninitialised value(s)
- ==3383== at 0x4082742: vfprintf (vfprintf.c:1619)
- ==3383== by 0x40891DE: printf (printf.c:35)
- ==3383== by 0x80483FB: main (ex4.c:8)
- ==3383==
- 134513373
- ==3383== Use of uninitialised value of size 4
- ==3383== at 0x407EB2B: _itoa_word (_itoa.c:195)
- ==3383== by 0x4082E55: vfprintf (vfprintf.c:1619)
- ==3383== by 0x40891DE: printf (printf.c:35)
- ==3383== by 0x4058112: (below main) (libc-start.c:226)
- ==3383==
- ==3383== Conditional jump or move depends on uninitialised value(s)
- ==3383== at 0x407EB33: _itoa_word (_itoa.c:195)
- ==3383== by 0x4082E55: vfprintf (vfprintf.c:1619)
- ==3383== by 0x40891DE: printf (printf.c:35)
- ==3383== by 0x4058112: (below main) (libc-start.c:226)
- ==3383==
- ==3383== Conditional jump or move depends on uninitialised value(s)
- ==3383== at 0x4082C10: vfprintf (vfprintf.c:1619)
- ==3383== by 0x40891DE: printf (printf.c:35)
- ==3383== by 0x4058112: (below main) (libc-start.c:226)
- ==3383==
- ==3383== Conditional jump or move depends on uninitialised value(s)
- ==3383== at 0x4082742: vfprintf (vfprintf.c:1619)
- ==3383== by 0x40891DE: printf (printf.c:35)
- ==3383== by 0x4058112: (below main) (libc-start.c:226)
- ==3383==
- I am 0 years old.
- I am 68906996 inches tall.
- ==3383==
- ==3383== HEAP SUMMARY:
- ==3383== in use at exit: 0 bytes in 0 blocks
- ==3383== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
- ==3383==
- ==3383== All heap blocks were freed -- no leaks are possible
- ==3383==
- ==3383== For counts of detected and suppressed errors, rerun with: -v
- ==3383== Use --track-origins=yes to see where uninitialised values come from
- ==3383== ERROR SUMMARY: 42 errors from 8 contexts (suppressed: 11 from 6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement