Opened 11 years ago

Last modified 10 years ago

#6302 new Bugs

int_adapter<T>::from_special(special_values) is not inlined, so duplicated

Reported by: viboes Owned by: az_sw_dude
Milestone: Component: date_time
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

It seems that this function

template<typename int_type_>
class int_adapter {

  static int_adapter from_special(special_values sv)
  {
    switch (sv) {
    case not_a_date_time: return not_a_number();
    case neg_infin:       return neg_infinity();
    case pos_infin:       return pos_infinity();
    case max_date_time:   return (max)();
    case min_date_time:   return (min)();
    default:              return not_a_number();
    }
  }

is not been inlined with gcc 3.4.6 and so it is duplicated at link time. See link error on regression test

Test output: Sandia-gcc-3.4.6 - thread - test_condition_lib / gcc-3.4.6
Rev 76061 / Mon, 19 Dec 2011 12:54:33 +0000
Report Time: Mon, 19 Dec 2011 21:30:12 +0000

Compile [2011-12-19 13:33:17 UTC]: succeed

"/sierra/Sntools/extras/compilers/gcc-3.4.6/bin/g++"  -ftemplate-depth-128 -O0 -fno-inline -Wall -g -pthread -fPIC -m32  -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_NO_AUTO_LINK=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1  -I".." -c -o "/scratch/kbelco/boost/results/boost/bin.v2/libs/thread/test/test_condition_lib.test/gcc-3.4.6/debug/address-model-32/threading-multi/test_condition.o" "../libs/thread/test/test_condition.cpp"


Link [2011-12-19 13:33:17 UTC]: fail

    "/sierra/Sntools/extras/compilers/gcc-3.4.6/bin/g++"    -o "/scratch/kbelco/boost/results/boost/bin.v2/libs/thread/test/test_condition_lib.test/gcc-3.4.6/debug/address-model-32/threading-multi/test_condition_lib" -Wl,--start-group "/scratch/kbelco/boost/results/boost/bin.v2/libs/thread/test/test_condition_lib.test/gcc-3.4.6/debug/address-model-32/threading-multi/test_condition.o" "/scratch/kbelco/boost/results/boost/bin.v2/libs/thread/test/test_condition_lib.test/gcc-3.4.6/debug/address-model-32/threading-multi/tss_null.o" "/scratch/kbelco/boost/results/boost/bin.v2/libs/test/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_unit_test_framework.a" "/scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a"  -Wl,-Bstatic  -Wl,-Bdynamic -lrt -Wl,--end-group -g -pthread -m32 


`.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' referenced in section `.rodata' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o): defined in discarded section `.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o)
`.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' referenced in section `.rodata' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o): defined in discarded section `.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o)
`.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' referenced in section `.rodata' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o): defined in discarded section `.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o)
`.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' referenced in section `.rodata' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o): defined in discarded section `.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o)
`.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' referenced in section `.rodata' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o): defined in discarded section `.gnu.linkonce.t._ZN5boost9date_time11int_adapterIxE12from_specialENS0_14special_valuesE' of /scratch/kbelco/boost/results/boost/bin.v2/libs/thread/build/gcc-3.4.6/debug/address-model-32/link-static/threading-multi/libboost_thread.a(thread.o)
collect2: ld returned 1 exit status

Change History (1)

comment:1 by az_sw_dude, 10 years ago

Milestone: To Be Determined

g++3.4.6 is a rather old compiler at this point so unfortunately I see this more as a compiler issue than a library issue. In fact, this code was never an issue in older versions of g++ on other platforms in the past either. The direction of date_time is toward a fully inline implementation, so moving this into the library isn't really an option. So will not fix -- will update regression status information.

Note: See TracTickets for help on using tickets.