Valgrind的在OS X上的优胜美地,给人虚假的错误? [英] Valgrind on OS X Yosemite, giving bogus errors?

查看:199
本文介绍了Valgrind的在OS X上的优胜美地,给人虚假的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在学习C艰难的历程和我在练习4:介绍Valgrind的。我在Mac OS X中的优胜美地,而截至记者发稿,有没有Valgrind的为优胜美地一个稳定版本。我发现 Yosemite和Valgrind的,并使用来自顶级投回答的方向 BREW安装--HEAD的valgrind 。这种安装Valgrind的,我能够与捷思锐的运动来进行操作。然而,当我固定的应用程序,我仍然得到错误。

I'm following along in Learn C The Hard Way and I'm on Exercise 4: Introducing Valgrind. I'm on Mac OS X Yosemite, and as of this writing, there's not a stable build of Valgrind for Yosemite. I found Yosemite and Valgrind and used the directions from the top-voted answer to brew install --HEAD valgrind. This installed Valgrind and I was able to follow along with Zed's exercise. However, when I "fixed" the app, I was still getting errors.

要仔细检查,我又回到了练习3 ,该应该不会有错误,但我还是在Valgrind的得到了错误。这里的code,然后输出:

To double check, I went back to Exercise 3, which shouldn't have errors, but I still got errors in Valgrind. Here's the code and then the output:

ex3.c

#include <stdio.h>

int main()
{
    int age = 10;
    int height = 72;

    printf("I am %d years old.\n", age);
    printf("I am %d inches tall.\n", height);

    return 0;
}

在的iTerm:

ransom:learn-c-the-hard-way ben$ rm -f ex3
ransom:learn-c-the-hard-way ben$ make ex3
cc -Wall -g    ex3.c   -o ex3
ransom:learn-c-the-hard-way ben$ valgrind ./ex3
==8795== Memcheck, a memory error detector
==8795== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==8795== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info
==8795== Command: ./ex3
==8795==
==8795== Conditional jump or move depends on uninitialised value(s)
==8795==    at 0x1003FBC3F: _platform_memchr$VARIANT$Haswell (in /usr/lib/system/libsystem_platform.dylib)
==8795==    by 0x1001EFB96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x1001F9FE5: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x10021F9AE: __v2printf (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x10021FC80: __xvprintf (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x1001F5B71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x1001F39D7: printf (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x100000F2D: main (ex3.c:8)
==8795==
==8795== Conditional jump or move depends on uninitialised value(s)
==8795==    at 0x1003FBC47: _platform_memchr$VARIANT$Haswell (in /usr/lib/system/libsystem_platform.dylib)
==8795==    by 0x1001EFB96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x1001F9FE5: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x10021F9AE: __v2printf (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x10021FC80: __xvprintf (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x1001F5B71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x1001F39D7: printf (in /usr/lib/system/libsystem_c.dylib)
==8795==    by 0x100000F2D: main (ex3.c:8)
==8795==
I am 10 years old.
I am 72 inches tall.
==8795==
==8795== HEAP SUMMARY:
==8795==     in use at exit: 38,888 bytes in 426 blocks
==8795==   total heap usage: 506 allocs, 80 frees, 45,016 bytes allocated
==8795==
==8795== LEAK SUMMARY:
==8795==    definitely lost: 0 bytes in 0 blocks
==8795==    indirectly lost: 0 bytes in 0 blocks
==8795==      possibly lost: 0 bytes in 0 blocks
==8795==    still reachable: 4,096 bytes in 1 blocks
==8795==         suppressed: 34,792 bytes in 425 blocks
==8795== Rerun with --leak-check=full to see details of leaked memory
==8795==
==8795== For counts of detected and suppressed errors, rerun with: -v
==8795== Use --track-origins=yes to see where uninitialised values come from
==8795== ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 0 from 0)

它说,我得到条件跳转或移动依赖于未初始化值(S) ex3.c:8 ,而高度变量初始化第6行。

It says I'm getting Conditional jump or move depends on uninitialized value(s) on ex3.c:8, but the height variable is initialized on line 6.

我的的是,这是在优胜美地与Valgrind的问题,错误的是假的,但我很新的C,虽然我相当肯定的code是正确的,我也不知道是否有可能是我丢失的东西。

My guess is that this is a problem with Valgrind on Yosemite and the error is bogus, but I'm very new to C and while I'm fairly certain the code is correct, I also don't know if there might be something I'm missing.

时它Valgrind的还是我的code的一个问题?

Is it a problem with Valgrind or my code?

推荐答案

这具体报告代表Valgrind的的假阳性。 Valgrind的约塞米蒂上还没有完全覆盖所有的角落情况下,系统库和最佳化的库使用。

This specific report is a false positive on Valgrind's behalf. Valgrind on Yosemite does not yet fully cover the system libraries for all corner cases and optimisations those libraries use.

下面的提示是函数名_platform_memchr $ VARIANT $ Haswell的,即这个bug的presence将取决于你的系统硬件,在这种情况下,你是否有一个基于Haswell的英特尔CPU。

The hint here is the function name _platform_memchr$VARIANT$Haswell i.e. the presence of this bug will depend on your system hardware, in this case whether you have an Intel Haswell-based CPU.

这将是巨大的,如果你能报告每个Valgrind的的 http://valgrind.org/support/bug_reports.html以便它可以先于下一个稳定Valgrind的释放是固定的。

It would be great if you can report this bug per Valgrind's http://valgrind.org/support/bug_reports.html so that it can be fixed prior to the next stable Valgrind release.

披露:我的Valgrind的开发者之一谁贡献补丁支持OS X 10.10

这篇关于Valgrind的在OS X上的优胜美地,给人虚假的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆