Try to make this test more consistent across different machines.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8182 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/memcheck/tests/origin2-not-quite.c b/memcheck/tests/origin2-not-quite.c
index a973173..e2d2582 100644
--- a/memcheck/tests/origin2-not-quite.c
+++ b/memcheck/tests/origin2-not-quite.c
@@ -13,37 +13,48 @@
 
 typedef long long Long;
 
+__attribute__((noinline)) int t1(void);
+__attribute__((noinline)) int t2(void);
+__attribute__((noinline)) int t3(void);
+
 int main(void)
 {
    assert(4 == sizeof(int));
    assert(8 == sizeof(Long));
 
+   x += t1();
+   x += t2();
+   x += t3();
+
+   return x & 255;
+}
+   
+__attribute__((noinline)) int t1(void)
+{
    // 64-bit undefined double.
-   {
-      double* ptr_to_undef_double = malloc(sizeof(double));
-      double  undef_double = *ptr_to_undef_double;
-      fprintf(stderr, "\nUndef 1 of 3 (64-bit FP)\n");
-      x += (undef_double < (double)123.45 ? 12 : 23);
-   }
+   double* ptr_to_undef_double = malloc(sizeof(double));
+   double  undef_double = *ptr_to_undef_double;
+   fprintf(stderr, "\nUndef 1 of 3 (64-bit FP)\n");
+   return (undef_double < (double)123.45 ? 12 : 23);
+}
 
+__attribute__((noinline)) int t2(void)
+{
    // 32-bit undefined float.
-   {
-      float* ptr_to_undef_float = malloc(sizeof(float));
-      float undef_float = *ptr_to_undef_float;
-      fprintf(stderr, "\nUndef 2 of 3 (32-bit FP)\n");
-      x += (undef_float < (float)234.56  ? 13 : 24);
-   }
+   float* ptr_to_undef_float = malloc(sizeof(float));
+   float undef_float = *ptr_to_undef_float;
+   fprintf(stderr, "\nUndef 2 of 3 (32-bit FP)\n");
+   return (undef_float < (float)234.56  ? 13 : 24);
+}
 
+__attribute__((noinline)) int t3(void)
+{
    // Stack, 32-bit, recently modified.
    // Problem here is that we don't chase backwards through loads and
    // stores.  Ie. the variable is stored after it's been modified, then
    // loaded again, so we don't see the unmodified version.
-   {
-      int modified_undef_stack_int;
-      modified_undef_stack_int++;
-      fprintf(stderr, "\nUndef 3 of 3 (int)\n");
-      x += (modified_undef_stack_int == 0x1234 ? 11 : 22);
-   }
-   
-   return x;
+   int modified_undef_stack_int;
+   modified_undef_stack_int++;
+   fprintf(stderr, "\nUndef 3 of 3 (int)\n");
+   return (modified_undef_stack_int == 0x1234 ? 11 : 22);
 }
diff --git a/memcheck/tests/origin2-not-quite.stderr.exp b/memcheck/tests/origin2-not-quite.stderr.exp
index 3f4e86b..b800d37 100644
--- a/memcheck/tests/origin2-not-quite.stderr.exp
+++ b/memcheck/tests/origin2-not-quite.stderr.exp
@@ -1,22 +1,27 @@
 
 Undef 1 of 3 (64-bit FP)
 Conditional jump or move depends on uninitialised value(s)
-   at 0x........: main (origin2-not-quite.c:26)
+   at 0x........: t1 (origin2-not-quite.c:38)
+   by 0x........: main (origin2-not-quite.c:25)
  Uninitialised value was created by a heap allocation
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: main (origin2-not-quite.c:23)
+   by 0x........: t1 (origin2-not-quite.c:35)
+   by 0x........: main (origin2-not-quite.c:25)
 
 Undef 2 of 3 (32-bit FP)
 
 Conditional jump or move depends on uninitialised value(s)
-   at 0x........: main (origin2-not-quite.c:34)
+   at 0x........: t2 (origin2-not-quite.c:47)
+   by 0x........: main (origin2-not-quite.c:26)
  Uninitialised value was created by a heap allocation
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: main (origin2-not-quite.c:31)
+   by 0x........: t2 (origin2-not-quite.c:44)
+   by 0x........: main (origin2-not-quite.c:26)
 
 Undef 3 of 3 (int)
 
 Conditional jump or move depends on uninitialised value(s)
-   at 0x........: main (origin2-not-quite.c:45)
+   at 0x........: t3 (origin2-not-quite.c:59)
+   by 0x........: main (origin2-not-quite.c:27)
  Uninitialised value was created by a stack allocation
-   at 0x........: main (origin2-not-quite.c:17)
+   at 0x........: t3 (origin2-not-quite.c:51)