[tor-bugs] #18095 [Tor]: Unit test integer precision warnings on 32 bit clang targets

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Jan 19 01:33:29 UTC 2016


#18095: Unit test integer precision warnings on 32 bit clang targets
------------------------+--------------------------------
     Reporter:  teor    |      Owner:
         Type:  defect  |     Status:  new
     Priority:  Medium  |  Milestone:  Tor: 0.2.8.x-final
    Component:  Tor     |    Version:
     Severity:  Minor   |   Keywords:  easy
Actual Points:          |  Parent ID:
       Points:          |    Sponsor:
------------------------+--------------------------------
 I think #17076 introduced some integer precision warnings on 32 bit clang
 targets.

 https://jenkins.torproject.org/job/tor-ci-linux-master-
 clang/997/ARCHITECTURE=i386,SUITE=sid/console

 {{{
 01:08:40 src/test/test_options.c:2311:25: error: implicit conversion loses
 integer precision: 'uint64_t' (aka 'unsigned long long') to 'long'
 [-Werror,-Wshorten-64-to-32]
 01:08:40   tt_int_op(tdata->opt->RelayBandwidthBurst, OP_EQ, 1000);
 01:08:40   ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 01:08:40 ./src/ext/tinytest_macros.h:158:22: note: expanded from macro
 'tt_int_op'
 01:08:40         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op
 val2_), \
 01:08:40                             ^
 01:08:40 ./src/ext/tinytest_macros.h:144:26: note: expanded from macro
 'tt_assert_test_type'
 01:08:40         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,
 \
 01:08:40                                 ^
 01:08:40 ./src/ext/tinytest_macros.h:116:16: note: expanded from macro
 'tt_assert_test_fmt_type'
 01:08:40         type val1_ = (a);
 \
 01:08:40                       ^
 01:08:40 src/test/test_options.c:2319:25: error: implicit conversion loses
 integer precision: 'uint64_t' (aka 'unsigned long long') to 'long'
 [-Werror,-Wshorten-64-to-32]
 01:08:40   tt_int_op(tdata->opt->RelayBandwidthRate, OP_EQ, 1001);
 01:08:40   ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 01:08:40 ./src/ext/tinytest_macros.h:158:22: note: expanded from macro
 'tt_int_op'
 01:08:40         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op
 val2_), \
 01:08:40                             ^
 01:08:40 ./src/ext/tinytest_macros.h:144:26: note: expanded from macro
 'tt_assert_test_type'
 01:08:40         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,
 \
 01:08:40                                 ^
 01:08:40 ./src/ext/tinytest_macros.h:116:16: note: expanded from macro
 'tt_assert_test_fmt_type'
 01:08:40         type val1_ = (a);
 \
 01:08:40                       ^
 01:08:40 src/test/test_options.c:2350:25: error: implicit conversion loses
 integer precision: 'uint64_t' (aka 'unsigned long long') to 'long'
 [-Werror,-Wshorten-64-to-32]
 01:08:40   tt_int_op(tdata->opt->BandwidthRate, OP_EQ, 1001);
 01:08:40   ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
 01:08:40 ./src/ext/tinytest_macros.h:158:22: note: expanded from macro
 'tt_int_op'
 01:08:40         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op
 val2_), \
 01:08:40                             ^
 01:08:40 ./src/ext/tinytest_macros.h:144:26: note: expanded from macro
 'tt_assert_test_type'
 01:08:40         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,
 \
 01:08:40                                 ^
 01:08:40 ./src/ext/tinytest_macros.h:116:16: note: expanded from macro
 'tt_assert_test_fmt_type'
 01:08:40         type val1_ = (a);
 \
 01:08:40                       ^
 01:08:40 src/test/test_options.c:2362:25: error: implicit conversion loses
 integer precision: 'uint64_t' (aka 'unsigned long long') to 'long'
 [-Werror,-Wshorten-64-to-32]
 01:08:40   tt_int_op(tdata->opt->BandwidthBurst, OP_EQ, 1001);
 01:08:40   ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 01:08:40 ./src/ext/tinytest_macros.h:158:22: note: expanded from macro
 'tt_int_op'
 01:08:40         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op
 val2_), \
 01:08:40                             ^
 01:08:40 ./src/ext/tinytest_macros.h:144:26: note: expanded from macro
 'tt_assert_test_type'
 01:08:40         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,
 \
 01:08:40                                 ^
 01:08:40 ./src/ext/tinytest_macros.h:116:16: note: expanded from macro
 'tt_assert_test_fmt_type'
 01:08:40         type val1_ = (a);
 \
 01:08:40                       ^
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18095>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list