https://bugs.kde.org/show_bug.cgi?id=424656

            Bug ID: 424656
           Summary: Uninitialised value was created by a heap allocation
           Product: valgrind
           Version: unspecified
          Platform: Debian testing
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: rstan...@rsiny.com
  Target Milestone: ---

SUMMARY
Possible incorrect errors using the source below.  Occurs with gcc-8, gcc-9,
gcc-10 on Debian Testing, "valgrind-3.16.1"

STEPS TO REPRODUCE
1. Source:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define DIM 32

int main(void)
{
   char *p = NULL;

   p = malloc(DIM);

   if(p == NULL)
   {
      printf("Allocation error.\n");
      exit(1);
   }

   strcpy(p, "This is a test.");

   for(int x = 0 ; x < DIM; ++x)
   {
      printf("%02x ",  p[x]);
   }
   putchar('\n');

   free(p);

   return 0;
}

2.  "gcc -std=c18 -Wall -Wextra -Wpedantic -g -I . -o ptest ptest.c"

3. "valgrind -s --track-origins=yes ./ptest"

OBSERVED RESULT

==11539== Use of uninitialised value of size 8
==11539==    at 0x48B4E5A: _itoa_word (_itoa.c:180)
==11539==    by 0x48CE753: __vfprintf_internal (vfprintf-internal.c:1687)
==11539==    by 0x48BAD6A: printf (printf.c:33)
==11539==    by 0x10920D: main (ptest.c:33)
==11539==  Uninitialised value was created by a heap allocation
==11539==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==11539==    by 0x10919E: main (ptest.c:21)
==11539== 
...


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to