Menu

#3599 128 bit arithmetic on x86_64

closed-fixed
7
2007-02-13
2006-12-18
No

After compiling tcltest from the CVS head on 18-dec-2006 on a 64bit linux machine (Intel Xeon) using gcc3.2.3, several tests with doubles failed. An example:

set x [expr 30.0e1]
puts "x='$x'"

This caused an infinite loop in mp_div (bn_mp_div.c). Daniel Steffen proposed a patch on the tcl chat as he had done for Darwin:

2006-08-18 Daniel Steffen

* generic/tclTomMath.h: on Darwin 64-bit, for now disable use of 128-bit arithmetic through __attribute__ ((mode(TI))), as it leads to link errors due to missing fallbacks. (rdar://4685527)

Making sure MP_64BIT is not defined in tclTomMath.h solves the problem.

Regards,

Jos.

Discussion

  • Peter Spjuth

    Peter Spjuth - 2006-12-18

    Logged In: YES
    user_id=98900
    Originator: NO

    See also 1601380, which probably has the same cause.

     
  • Don Porter

    Don Porter - 2006-12-18
    • assigned_to: dgp --> das
     
  • Don Porter

    Don Porter - 2006-12-18

    Logged In: YES
    user_id=80530
    Originator: NO

    sounds like das has a handle on
    this. passing to him to correct
    as he sees fit.

     
  • Daniel A. Steffen

    • priority: 5 --> 7
    • assigned_to: das --> kennykb
     
  • Daniel A. Steffen

    Logged In: YES
    user_id=90580
    Originator: NO

    I don't have any knowledge on why this fails on non-Darwin x86_64 platforms.

    The 2006-08-18 problem on Darwin was that gcc tetraint-arithmetic fallbacks were not implemented on the platform so use of operations like tetraint division in libtommath lead to link errors. The solution was to disable use of tetraints on that platform via #undef MP_64BIT in tclTomMath.h

    From this bug, it appears that on x86_64 platforms where linking with MP_64BIT defined does succeed, there may be problems with the use of tetraint arithmetic. My suggestion on the chat was simply to undefine MP_64BIT to see if tetraints were indeed to blame.
    I don't know if this should be done unconditionally on all x86_64 platforms/for all versions of gcc, somebody more familiar with libtommath needs to look at that, passing to kbk.

     
  • Daniel A. Steffen

    Logged In: YES
    user_id=90580
    Originator: NO

    verified that I see tetraint related test failures on the x86_64 host amd64-linux1 in the SF compilefarm, specifically, expr-47.12 crashes and mathop-25.23 hangs.
    both problems disappear when the MP_64BIT #define in tclTomMath.h is commented out.

    $ uname -a
    Linux amd64-linux1.cf.sourceforge.net 2.6.9-1.667smp #1 SMP Tue Nov 2 15:09:11 EST 2004 x86_64 x86_64 x86_64 GNU/Linux
    $ gcc -v
    gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

     
  • Kevin B KENNY

    Kevin B KENNY - 2007-02-13
    • status: open --> closed-fixed
     
  • Kevin B KENNY

    Kevin B KENNY - 2007-02-13

    Logged In: YES
    user_id=99768
    Originator: NO

    Indeed it does! Thanks for pointing this out; our fork of libtommath now avoids using TI.