From 5061fe24ec5cc0651010fb71aa3396c946caaac1 Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Tue, 24 Jun 2014 15:33:53 +0000 Subject: [PATCH] According to Julian initialising the previously uninitialised variable 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 | 2 -- memcheck/tests/pdb-realloc.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 1dddde37e..4e52ee0e9 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -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@ diff --git a/memcheck/tests/pdb-realloc.c b/memcheck/tests/pdb-realloc.c index fbb13c741..810f7b257 100644 --- a/memcheck/tests/pdb-realloc.c +++ b/memcheck/tests/pdb-realloc.c @@ -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; }