2015-03-08 213 views
1

我的Valgrind在優勝美地上遇到了一個奇怪的問題。這是我簡單的程序:未初始化的值 - Valgrind

#include <stdio.h> 
int main() { 
    printf("Hello world %d\n", 123); 
    return 0; 
} 

編譯它,然後使用Valgrind的運行它,我得到以下幾點:

==48900== Conditional jump or move depends on uninitialised value(s) 
==48900== at 0x1003FBC3F: _platform_memchr$VARIANT$Haswell (in /usr/lib/system/libsystem_platform.dylib) 
==48900== by 0x1001EFB96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib) 
==48900== by 0x1001F9FE5: __vfprintf (in /usr/lib/system/libsystem_c.dylib) 
==48900== by 0x10021F9AE: __v2printf (in /usr/lib/system/libsystem_c.dylib) 
==48900== by 0x10021FC80: __xvprintf (in /usr/lib/system/libsystem_c.dylib) 
==48900== by 0x1001F5B71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) 
==48900== by 0x1001F39D7: printf (in /usr/lib/system/libsystem_c.dylib) 
==48900== by 0x100000F51: main (test.c:3) 
==48900== 
Hello world 123 
==48900== 
==48900== HEAP SUMMARY: 
==48900==  in use at exit: 39,212 bytes in 426 blocks 
==48900== total heap usage: 506 allocs, 80 frees, 45,340 bytes allocated 
==48900== 
==48900== LEAK SUMMARY: 
==48900== definitely lost: 16 bytes in 1 blocks 
==48900== indirectly lost: 0 bytes in 0 blocks 
==48900==  possibly lost: 13,058 bytes in 117 blocks 
==48900== still reachable: 26,138 bytes in 308 blocks 
==48900==   suppressed: 0 bytes in 0 blocks 
==48900== Rerun with --leak-check=full to see details of leaked memory 
==48900== 
==48900== For counts of detected and suppressed errors, rerun with: -v 
==48900== Use --track-origins=yes to see where uninitialised values come from 
==48900== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) 

有什麼建議?

+0

這似乎是你的C庫或valigrind爲您的平臺的錯誤。 – 2015-03-08 17:35:24

+0

我不知道Valgrind還支持優勝美地;最後我聽說OS X的[最新版本支持](http://valgrind.org/downloads/current.html)是Mavericks。最近有沒有變化? (在他的MBAir上與Yosemite 10.10.2對話)。 – WhozCraig 2015-03-08 17:36:21

+0

@WhozCraig這是一個有趣的一點,當我重新安裝** glibc **因爲安全更新Valgrind開始具有這種行爲。直到我重新編譯它,如果它支持新的** glibc **這往往不是這種情況,然後我不得不等待新的valgrind版本。 – 2015-03-08 17:37:39

回答

0

這很有用:Yosemite and Valgrind儘管在過去的OS X發佈週期中Valgrind花了一段時間才實現合理的功能支持,但基本的OS X 10.10支持已經在Valgrind主幹中可用,在預發佈優勝美地 - 戴夫Qorashi

相關問題