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
This commit is contained in:
Florian Krohm 2014-06-24 15:33:53 +00:00
parent d7cccf3f9f
commit 5061fe24ec
2 changed files with 3 additions and 3 deletions

View 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@

View 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;
}