|
From: <sv...@va...> - 2014-06-24 15:34:03
|
Author: florian
Date: Tue Jun 24 15:33:53 2014
New Revision: 14094
Log:
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.
Modified:
trunk/memcheck/tests/Makefile.am
trunk/memcheck/tests/pdb-realloc.c
Modified: trunk/memcheck/tests/Makefile.am
==============================================================================
--- trunk/memcheck/tests/Makefile.am (original)
+++ trunk/memcheck/tests/Makefile.am Tue Jun 24 15:33:53 2014
@@ -443,8 +443,6 @@
# 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@
Modified: trunk/memcheck/tests/pdb-realloc.c
==============================================================================
--- trunk/memcheck/tests/pdb-realloc.c (original)
+++ trunk/memcheck/tests/pdb-realloc.c Tue Jun 24 15:33:53 2014
@@ -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 @@
for (i = 0; i < 1000; i++)
t += x[i];
+ __asm__ __volatile__ ("" :: "r"(t));
+
return 0;
}
|