valgrind: Fehler bei einfacher Ausgabe



  • Hallo Community,

    ich habe mich erstmals mit Valgrind befasst und versuche eine Fehlermeldung weg zu bekommen, aber ich scheine da irgendwas nicht richtig zu verstehen.
    Hier ist mein Code:

    #include <stdio.h>
    
    int main()
    {
    	int x;
    	x = 5;
    	printf("Hello World %i\n", x);
    	return 0;
    }
    

    Wenn ich die 5 direkt als Argument übergebe (und x komplett weg lasse) entstehet die Fehlermeldung auch.

    (Die Fehlermeldung ist weg, wenn ich die Variabel, das "%i" und das Argument komplett entferne.)

    ==11662== Memcheck, a memory error detector
    ==11662== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
    ==11662== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info
    ==11662== Command: ./ex4
    ==11662== 
    ==11662== Conditional jump or move depends on uninitialised value(s)
    ==11662==    at 0x1003FAC3F: _platform_memchr$VARIANT$Haswell (in /usr/lib/system/libsystem_platform.dylib)
    ==11662==    by 0x1001EEB96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
    ==11662==    by 0x1001F8FE5: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
    ==11662==    by 0x10021E9AE: __v2printf (in /usr/lib/system/libsystem_c.dylib)
    ==11662==    by 0x10021EC80: __xvprintf (in /usr/lib/system/libsystem_c.dylib)
    ==11662==    by 0x1001F4B71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
    ==11662==    by 0x1001F29D7: printf (in /usr/lib/system/libsystem_c.dylib)
    ==11662==    by 0x100000F51: main (ex4.c:5)
    ==11662== 
    Hello World 5
    ==11662== 
    ==11662== HEAP SUMMARY:
    ==11662==     in use at exit: 38,694 bytes in 422 blocks
    ==11662==   total heap usage: 501 allocs, 79 frees, 44,798 bytes allocated
    ==11662== 
    ==11662== LEAK SUMMARY:
    ==11662==    definitely lost: 0 bytes in 0 blocks
    ==11662==    indirectly lost: 0 bytes in 0 blocks
    ==11662==      possibly lost: 0 bytes in 0 blocks
    ==11662==    still reachable: 0 bytes in 0 blocks
    ==11662==         suppressed: 38,694 bytes in 422 blocks
    ==11662== 
    ==11662== For counts of detected and suppressed errors, rerun with: -v
    ==11662== Use --track-origins=yes to see where uninitialised values come from
    ==11662== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
    

    Ist mein Valgrind kaputt??



  • Der Fehler ist zumindest nicht in Deinem Code.

    Lies http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress.

    Du wirst dann valgrind mit der --gen-suppressions Option aufrufen und Dir ein suppression-file bauen.
    Evtl. kannst Du im Internet auch schon eins für Dein OS finden und herunterladen.



  • Vielen Dank!


Anmelden zum Antworten