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 50731] New: apr_atomic_casptr has wrong volatile qualifier
Date Tue, 08 Feb 2011 10:29:12 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50731

           Summary: apr_atomic_casptr has wrong volatile qualifier
           Product: APR
           Version: HEAD
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: philip@apache.org


Created an attachment (id=26622)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26622)
apr_atomic_casptr volatile fix

The prototype for apr_atomic_casptr is

APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const
void
 *cmp);

The mem parameter has the wrong volatile qualifier, it is declared as "a
non-volatile pointer to a non-volatile pointer to volatile data" but CAS
operates on the value of the pointer, not on the value of the dereferenced
pointer, so it is the value of the pointer that should be volatile.

The correct prototype is

APR_DECLARE(void*) apr_atomic_casptr(void * volatile *mem, void *with, const
void
 *cmp);

This matches apr_atomic_cas32 where CAS applies to the int32 value and the
corresponding parameter is a "pointer to a volatile int32".

The function apr_atomic_xchgptr has a similar problem.

The attached patch has been tested on 64-bit Linux.

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