apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51851] Error in apr_atomic_xchgptr
Date Thu, 22 Sep 2011 09:58:27 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51851

--- Comment #2 from Mattias EngdegÄrd <mattiase@acm.org> 2011-09-22 09:58:27 UTC ---
This bug is not necessarily caught by the regression test (testatomic.c),
because of a poor choice of test pointer value (NULL). The following patch
makes the test stronger, and actually catches the bug:

--- test/testatomic.c    (revision 1174015)
+++ test/testatomic.c    (arbetskopia)
@@ -84,11 +84,12 @@
 static void test_xchgptr(abts_case *tc, void *data)
 {
     int a;
-    volatile void *target_ptr = NULL;
+    void *ref = "little piggy";
+    volatile void *target_ptr = ref;
     void *old_ptr;

     old_ptr = apr_atomic_xchgptr(&target_ptr, &a);
-    ABTS_PTR_EQUAL(tc, NULL, old_ptr);
+    ABTS_PTR_EQUAL(tc, ref, old_ptr);
     ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr);
 }

Also note that for the bug to show up, the bad code in atomic/unix/ia32.c must
be used, which is only the case when a gcc without builtin sync primitives was
used for the configuration script - that is, gcc 4.0.x or older.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message