Анализ отчета Valgrind: условный переход или перемещение зависит от неинициализированных значений - PullRequest
0 голосов
/ 13 октября 2018

Я пытался проанализировать отчет для Вальгринда.Отчет выглядит следующим образом. Почему условный переход или перемещение зависит от неинициализированных значений, которые несколько раз отображаются в отчете.

=483== Conditional jump or move depends on uninitialised value(s)
==483==    at 0x4E7DA42: vfprintf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4E878C8: printf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4005B2: main (p2.c:11)
==483==  Uninitialised value was created by a stack allocation
==483==    at 0x40057D: main (p2.c:7)
==483== 
==483== Use of uninitialised value of size 8
==483==    at 0x4E7CEDB: _itoa_word (in /usr/lib64/libc-2.17.so)
==483==    by 0x4E7DF55: vfprintf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4E878C8: printf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4005B2: main (p2.c:11)
==483==  Uninitialised value was created by a stack allocation
==483==    at 0x40057D: main (p2.c:7)
==483== 
==483== Conditional jump or move depends on uninitialised value(s)
==483==    at 0x4E7CEE5: _itoa_word (in /usr/lib64/libc-2.17.so)
==483==    by 0x4E7DF55: vfprintf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4E878C8: printf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4005B2: main (p2.c:11)
==483==  Uninitialised value was created by a stack allocation
==483==    at 0x40057D: main (p2.c:7)
==483== 
==483== Conditional jump or move depends on uninitialised value(s)
==483==    at 0x4E7DFA4: vfprintf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4E878C8: printf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4005B2: main (p2.c:11)
==483==  Uninitialised value was created by a stack allocation
==483==    at 0x40057D: main (p2.c:7)
==483== 
==483== Conditional jump or move depends on uninitialised value(s)
==483==    at 0x4E7DB0D: vfprintf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4E878C8: printf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4005B2: main (p2.c:11)
==483==  Uninitialised value was created by a stack allocation
==483==    at 0x40057D: main (p2.c:7)
==483== 
==483== Conditional jump or move depends on uninitialised value(s)
==483==    at 0x4E7DB90: vfprintf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4E878C8: printf (in /usr/lib64/libc-2.17.so)
==483==    by 0x4005B2: main (p2.c:11)
==483==  Uninitialised value was created by a stack allocation
==483==    at 0x40057D: main (p2.c:7)

Ниже приведен пример кода.

main()
{
    int *a,b;
    a=(int *)malloc(sizeof(int));
    *a=b;
    printf("%d",*a);
}
...