Subject: [Boost-bugs] [Boost C++ Libraries] #3341: sp_counted_base_gcc_sparc.hpp compile failure on gcc.4.2.3 w/-O2
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-08-13 19:20:12
#3341: sp_counted_base_gcc_sparc.hpp compile failure on gcc.4.2.3 w/-O2
---------------------------------------+------------------------------------
Reporter: jon_p_griffiths@⦠| Owner: pdimov
Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: smart_ptr
Version: Boost 1.39.0 | Severity: Problem
Keywords: gcc, CAS, sp_counted_base |
---------------------------------------+------------------------------------
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 <reg>+<offset> 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.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3341> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC