public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][PR 39480] Fix broken test case,
@ 2009-04-23 23:05 Doug Kwan (關振德)
  2009-04-24 16:23 ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Kwan (關振德) @ 2009-04-23 23:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jing Yu, jason

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][PR 39480] Fix broken test case,
  2009-04-23 23:05 [PATCH][PR 39480] Fix broken test case, Doug Kwan (關振德)
@ 2009-04-24 16:23 ` Jason Merrill
  2009-04-24 21:04   ` Doug Kwan (關振德)
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Merrill @ 2009-04-24 16:23 UTC (permalink / raw)
  To: "Doug Kwan (關振德)"; +Cc: gcc-patches, Jing Yu

Instead of the in_test flag, just make it check for src == dest.  OK 
with that change.

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][PR 39480] Fix broken test case,
  2009-04-24 16:23 ` Jason Merrill
@ 2009-04-24 21:04   ` Doug Kwan (關振德)
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Kwan (關振德) @ 2009-04-24 21:04 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches, Jing Yu

Patch was checked into revision 146744 of trunk.  Thanks.

2009/4/24 Jason Merrill <jason@redhat.com>:
> Instead of the in_test flag, just make it check for src == dest.  OK with
> that change.
>
> Jason
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-24 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 23:05 [PATCH][PR 39480] Fix broken test case, Doug Kwan (關振德)
2009-04-24 16:23 ` Jason Merrill
2009-04-24 21:04   ` Doug Kwan (關振德)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).