Patchwork [v3] enable commented out tests

login
register
mail settings
Submitter Jonathan Wakely
Date Oct. 30, 2013, 10:05 p.m.
Message ID <CAH6eHdRZTevY76_d0ti_9pUbtrf+SRZGecq+3ukyt119J0wycQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/287356/
State New
Headers show

Comments

Jonathan Wakely - Oct. 30, 2013, 10:05 p.m.
GCC allows arithmetic on void pointers so std::atomic<void*> does too,
but the VERIFY checks in this test were commented out, probably
because they failed due to using sizeof(void*) when they should have
used sizeof(void), which is 1.

2013-10-30  Jonathan Wakely  <jwakely.gcc@gmail.com>

    * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: Fix
    and enable VERIFY tests.

Tested x86_64-linux, committed to trunk.
commit 0224e88cccd5a4d4bf1f972a292bfc9e58d57382
Author: Jonathan Wakely <jwakely.gcc@gmail.com>
Date:   Wed Oct 30 17:57:50 2013 +0000

    	* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: Fix
    	and enable VERIFY tests.

Patch

diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
index fa936a1..3a4377f 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
@@ -42,28 +42,28 @@  int main(void)
   a++;
   void* vp3(a);
   dist = reinterpret_cast<char*>(vp2) - reinterpret_cast<char*>(vp3);
-  // VERIFY ( std::abs(dist) == sizeof(void*));
+  VERIFY ( std::abs(dist) == 1 );
 
   // operator--
   void* vp4(a);
   a--;
   void* vp5(a);
   dist = reinterpret_cast<char*>(vp4) - reinterpret_cast<char*>(vp5);
-  // VERIFY ( std::abs(dist) == sizeof(void*));
+  VERIFY ( std::abs(dist) == 1 );
 
   // operator+=
   void* vp6(a);
   a+=n;
   void* vp7(a);
   dist = reinterpret_cast<char*>(vp6) - reinterpret_cast<char*>(vp7);
-  // VERIFY ( std::abs(dist) == sizeof(void*) * n);
+  VERIFY ( std::abs(dist) == n );
 
   // operator-=
   void* vp8(a);
   a-=n;
   void* vp9(a);
   dist = reinterpret_cast<char*>(vp8) - reinterpret_cast<char*>(vp9);
-  //VERIFY ( std::abs(dist) == sizeof(void*) * n);
+  VERIFY ( std::abs(dist) == n );
 
   return 0;
 }