id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 3341,sp_counted_base_gcc_sparc.hpp compile failure on gcc.4.2.3 w/-O2,jon_p_griffiths@…,Peter Dimov,"compare_and_swap() from sp_counted_base_gcc_sparc.hpp fails to compile here with gcc 4.2.3 configured thusly: -bash-3.00$ /opt/gcc-4.2.3/bin/g++ -v Using built-in specs. Target: sparc64-sun-solaris2.10 Configured with: ../src/configure --host=sparc64-sun-solaris2.10 --with-gnu-as --with-as=/opt/binutils-2.17/bin/as --with-gnu-ld --with-ld=/opt/binutils-2.17/bin/ld --with-pic --enable-languages=c,c++ --prefix=/opt/gcc-4.2.3 Thread model: posix gcc version 4.2.3 The problem is the ""=m"" asm constraint in this function, which allows memory references of any form. When compiling with optimisation, gcc avoids some address math and ends up emitting + for the first operand in its inlined call. 'as' then refuses to assemble this ('Illegal Operands'). If the function is not inlined, the dest_ parameter has the offset added to it before being passed to the function and it then compiles quite happily. Unfortunately, gcc does not have an asm constraint to specify that offsets should not be used in memory references. I'm working around this locally by making the function static and attribute(noinline), which works with a small code size cost. An alternate fix would be to load the memory address from another register in the asm expression, but that's beyond my gcc asm-fu. Alternately, this may be considered a bug in the compiler - but adding the missing constraint is more likely to be considered a feature request IMO, hence the bug report here first. ",Bugs,closed,Boost 1.40.0,smart_ptr,Boost 1.39.0,Problem,fixed,"gcc, CAS, sp_counted_base",