Advertisement
Guest User

Untitled

a guest
Mar 5th, 2012
1,711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. CODE FOR new ex4.c
  2. ==================
  3.  
  4. #include <stdio.h>
  5.  
  6. int main()
  7. {
  8. int age = 10;
  9. int height;
  10.  
  11. bad_function();
  12.  
  13. printf("I am %d years old.\n");
  14. printf("I am %d inches tall.\n", height);
  15.  
  16. return 0;
  17. }
  18.  
  19. void bad_function()
  20. {
  21. int x;
  22. printf("%d\n", x);
  23. }
  24.  
  25.  
  26. =====================
  27. VALGRIND OUTPUT
  28. =====================
  29.  
  30. ==3383== Memcheck, a memory error detector
  31. ==3383== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
  32. ==3383== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
  33. ==3383== Command: ./ex4
  34. ==3383==
  35. ==3383== Use of uninitialised value of size 4
  36. ==3383== at 0x407EB2B: _itoa_word (_itoa.c:195)
  37. ==3383== by 0x4082E55: vfprintf (vfprintf.c:1619)
  38. ==3383== by 0x40891DE: printf (printf.c:35)
  39. ==3383== by 0x80483FB: main (ex4.c:8)
  40. ==3383==
  41. ==3383== Conditional jump or move depends on uninitialised value(s)
  42. ==3383== at 0x407EB33: _itoa_word (_itoa.c:195)
  43. ==3383== by 0x4082E55: vfprintf (vfprintf.c:1619)
  44. ==3383== by 0x40891DE: printf (printf.c:35)
  45. ==3383== by 0x80483FB: main (ex4.c:8)
  46. ==3383==
  47. ==3383== Conditional jump or move depends on uninitialised value(s)
  48. ==3383== at 0x4082C10: vfprintf (vfprintf.c:1619)
  49. ==3383== by 0x40891DE: printf (printf.c:35)
  50. ==3383== by 0x80483FB: main (ex4.c:8)
  51. ==3383==
  52. ==3383== Conditional jump or move depends on uninitialised value(s)
  53. ==3383== at 0x4082742: vfprintf (vfprintf.c:1619)
  54. ==3383== by 0x40891DE: printf (printf.c:35)
  55. ==3383== by 0x80483FB: main (ex4.c:8)
  56. ==3383==
  57. 134513373
  58. ==3383== Use of uninitialised value of size 4
  59. ==3383== at 0x407EB2B: _itoa_word (_itoa.c:195)
  60. ==3383== by 0x4082E55: vfprintf (vfprintf.c:1619)
  61. ==3383== by 0x40891DE: printf (printf.c:35)
  62. ==3383== by 0x4058112: (below main) (libc-start.c:226)
  63. ==3383==
  64. ==3383== Conditional jump or move depends on uninitialised value(s)
  65. ==3383== at 0x407EB33: _itoa_word (_itoa.c:195)
  66. ==3383== by 0x4082E55: vfprintf (vfprintf.c:1619)
  67. ==3383== by 0x40891DE: printf (printf.c:35)
  68. ==3383== by 0x4058112: (below main) (libc-start.c:226)
  69. ==3383==
  70. ==3383== Conditional jump or move depends on uninitialised value(s)
  71. ==3383== at 0x4082C10: vfprintf (vfprintf.c:1619)
  72. ==3383== by 0x40891DE: printf (printf.c:35)
  73. ==3383== by 0x4058112: (below main) (libc-start.c:226)
  74. ==3383==
  75. ==3383== Conditional jump or move depends on uninitialised value(s)
  76. ==3383== at 0x4082742: vfprintf (vfprintf.c:1619)
  77. ==3383== by 0x40891DE: printf (printf.c:35)
  78. ==3383== by 0x4058112: (below main) (libc-start.c:226)
  79. ==3383==
  80. I am 0 years old.
  81. I am 68906996 inches tall.
  82. ==3383==
  83. ==3383== HEAP SUMMARY:
  84. ==3383== in use at exit: 0 bytes in 0 blocks
  85. ==3383== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
  86. ==3383==
  87. ==3383== All heap blocks were freed -- no leaks are possible
  88. ==3383==
  89. ==3383== For counts of detected and suppressed errors, rerun with: -v
  90. ==3383== Use --track-origins=yes to see where uninitialised values come from
  91. ==3383== ERROR SUMMARY: 42 errors from 8 contexts (suppressed: 11 from 6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement