Opened 13 years ago

Closed 13 years ago

#3678 closed Bugs (fixed)

Build failure on SPARC64 architecture

Reported by: churanov.port.maintainer@… Owned by: Peter Dimov
Milestone: Boost 1.42.0 Component: smart_ptr
Version: Boost 1.41.0 Severity: Showstopper
Keywords: Cc:

Description

Boost 1.40.0 fail to build on SPARC64 machines.

The issue arises when code of smart_ptr is assembled. The "boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp" file contains SPARC-specific assembly for atomic compare-and-swap implementation and assembler rejects the code generated by the compiler out of that function. The generated code contains a "cas" instruction where first operand is a memory reference with complex addressing (register and offset). According to the SPARC v9 manual only register containing stored address may go there.

The patch for the issue was created, but a single test in "libs/smart_ptr/test" fails.

The patch is at http://alexanderchuranov.com/boost-port/boost-1.41-sparc64/patch-boost_smart_ptr_detail_sp_counted_base_gcc_sparc.hpp
The bjam test log is at http://alexanderchuranov.com/boost-port/boost-1.41-sparc64/bjam-smart-ptr-test.log

Environment:

Operating system - FreeBSD 8.0-BETA4 sparc64
Compiler - c++ (GCC) 4.2.1 20070719 [FreeBSD]
Assembler - GNU assembler 2.15 [FreeBSD] 2004-05-23

Change History (8)

comment:1 by Peter Dimov, 13 years ago

(In [57949]) Fix SPARC asm operand failure. Refs #3678. Refs #3341.

comment:2 by Peter Dimov, 13 years ago

Status: newassigned

It is normal for spinlock_try_test to fail in single-threaded mode. I've committed the patch to trunk. But there are two more tests whose results I'd like to see, shared_ptr_mt_test.cpp and weak_ptr_mt_test.cpp. They are not part of the Jamfile though, and need to be compiled and run manually.

comment:3 by churanov.port.maintainer@…, 13 years ago

Peter,

I've created a makefile to build and run the three tests with proper compiler settings. Could you examine the makefile and log and confirm that compiler flags are correct and tests are actually passing?

The machine is a SMP sparc64 (4 x 300 MHz).

External files: The patch - http://alexanderchuranov.com/boost-port/boost-1.41-sparc64/patch-boost_smart_ptr_detail_sp_counted_base_gcc_sparc.hpp
The makefile - http://alexanderchuranov.com/boost-port/boost-1.41-sparc64/Makefile
The output of "make test" - http://alexanderchuranov.com/boost-port/boost-1.41-sparc64/bjam-1.41-make-test.log

Alexander Churanov

comment:4 by Peter Dimov, 13 years ago

Everything looks fine. Can you please try the same at -O2 or -O3, and without -fno-inline?

comment:5 by churanov.port.maintainer@…, 13 years ago

Peter,

I've modified the makefile to accept optimization options on invocation and run with OPTIMIZATION='-O2' and OPTIMIZATION='-O3'. The output is much like the previous one (with -O0).

External files:

Makefile - http://alexanderchuranov.com/boost-port/boost-1.41-sparc64/Makefile2
Log with -O2 - http://alexanderchuranov.com/boost-port/boost-1.41-sparc64/smart_ptr_O2_test.log
Log with -O3 - http://alexanderchuranov.com/boost-port/boost-1.41-sparc64/smart_ptr_O3_test.log

Does this output mean that it is safe to check-in the patch?

Alexander Churanov

comment:6 by Peter Dimov, 13 years ago

The patch is already checked into trunk. I will now merge it into the release branch; the tests look OK.

comment:7 by anonymous, 13 years ago

I was meaning checking into the FreeBSD ports repository. :-) I'm sure that the next release of Boost will contain the patch. And I'm going to provide patches for 1.39 and 1.41 on FreeBSD.

Thank you for cooperation!

comment:8 by Peter Dimov, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [58063]) Merge [57949] to release. Fixes #3678. Fixes #3341.

Note: See TracTickets for help on using tickets.