]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
According to Julian initialising the previously uninitialised variable
authorFlorian Krohm <florian@eich-krohm.de>
Tue, 24 Jun 2014 15:33:53 +0000 (15:33 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Tue, 24 Jun 2014 15:33:53 +0000 (15:33 +0000)
won't affect the test adversely -- so let's do this and get rid of
the special compilation again. Also guard against future compiler smartness
tricking the compiler into believing the variable is actually used.
So the loop won't get optimised away.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14094

memcheck/tests/Makefile.am
memcheck/tests/pdb-realloc.c

index 1dddde37eccaa4b097762e5849c40a380a863d28..4e52ee0e97e516d1cddf8c4fb6f865027a2688d3 100644 (file)
@@ -443,8 +443,6 @@ origin6_fp_CFLAGS   = $(AM_CFLAGS) -O
 # because then we can't intercept it
 overlap_CFLAGS         = $(AM_CFLAGS) -fno-builtin-memcpy -fno-builtin-strcpy
 
-pdb_realloc_CFLAGS     = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
-
 str_tester_CFLAGS      = $(AM_CFLAGS) -Wno-shadow
 
 supp_CFLAGS             = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
index fbb13c7414603365c72c39b8c587000b03f92894..810f7b2575c49cd37352517e75432f43431c1515 100644 (file)
@@ -12,7 +12,7 @@
 
 int main(void)
 {
-   int i, t;
+   int i, t = 0;
    char* x = malloc(1000);
 
    // Write some PDBs (partially defined bytes)
@@ -26,6 +26,8 @@ int main(void)
    for (i = 0; i < 1000; i++)
       t += x[i];
    
+   __asm__ __volatile__ ("" :: "r"(t));
+
    return 0;
 }