[PATCH][PR 39480] Fix broken test case,

Doug Kwan (關振德) dougkwan@google.com
Thu Apr 23 23:05:00 GMT 2009


This patch fixes a broken test checked in 2 weeks ago for PR 39480.
The test unconditionally overrides the behaviour of memcpy and
redirect it to abort().  That causes failure in an arm-none-eabi
tool-chain with newlib as memcpy is also called during exit.  I tested
this on arm-none-eabi.

2008-04-23  Doug Kwan  <dougkwan@google.com>

        * g++.dg/init/copy7.C: Only override behaviour of memcpy during
        testing.

ndex: gcc/gcc/testsuite/g++.dg/init/copy7.C
===================================================================
--- gcc/gcc/testsuite/g++.dg/init/copy7.C       (revision 146655)
+++ gcc/gcc/testsuite/g++.dg/init/copy7.C       (working copy)
@@ -2,11 +2,20 @@
 // It isn't always safe to call memcpy with identical arguments.
 // { dg-do run }

+static int in_test;
+
 extern "C" void abort();
 extern "C" void *
 memcpy(void *dest, void *src, __SIZE_TYPE__ n)
 {
-  abort();
+  if (in_test)
+    abort();
+  else
+    {
+      __SIZE_TYPE__ i;
+      for (i = 0; i < n; i++)
+        ((char *)dest)[i] = ((const char*)src)[i];
+    }
 }

 struct A
@@ -28,5 +37,7 @@ void f(B *a1, B* a2)

 int main()
 {
+  in_test = 1;
   f(&b,&b);
+  in_test = 0;
 }



More information about the Gcc-patches mailing list