[zeromq-dev] Casting bug in atomic_counter.hpp - probably only on non x86 or ARM CPUs.

Dr. David Kirkby (Kirkby Microwave Ltd) drkirkby at kirkbymicrowave.co.uk
Tue Jun 2 13:51:45 CEST 2015

I was trying to build SageMath 6.7


on a Sun workstation with an UltraSPARC III+ processor running Solaris
10.  The SageMath software includes the full unmodified zeromq 4.0.5.
The buld fails when buidling zeromq 4.0.5, with gcc 4.9.2 indicating
an error. I believe that this error will only be seen on CPUs that are
neither ARM or x86, which probably means it is not going to be
encountered much.  This is the error reported by gcc.

atomic_counter.hpp:87:71: error: invalid conversion from 'volatile
integer_t* {aka volatile unsigned int*}' to 'uint32_t* {aka unsigned
int*}' [-fpermissive]

This is line 87 which the error refers to.

integer_t new_value = atomic_add_32_nv (&value, increment_);

a similar issue is on line 130

integer_t nv = atomic_add_32_nv (&value, delta);

I think the issue might be related to the fact "value" is declared
volatile, but the prototype for atomic_add_32_nv() is not expecting
volatile. But I may be wrong.

I have described the problem in more detail on the SageMath bug tracker here.


Dr. David Kirkby Ph.D CEng MIET
Kirkby Microwave Ltd
Registered office: Stokes Hall Lodge, Burnham Rd, Althorne, Essex, CM3 6DT, UK.
Registered in England and Wales, company number 08914892.
Tel: 07910 441670 / +44 7910 441670 (0900 to 2100 GMT only please)

More information about the zeromq-dev mailing list