On Fri, Nov 23, 2007 at 05:59:23AM +0100, Karl Sjodahl - dunceor wrote:

> On Nov 22, 2007 10:29 PM, Otto Moerbeek <[EMAIL PROTECTED]> wrote:
> >
> > On Thu, Nov 22, 2007 at 09:39:47PM +0100, Otto Moerbeek wrote:
> >
> > > On Thu, Nov 22, 2007 at 09:29:00PM +0100, Karl Sjodahl - dunceor wrote:
> > >
> > > > On Nov 22, 2007 9:03 PM, Otto Moerbeek <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > On Thu, Nov 22, 2007 at 03:09:41PM +0100, Karl Sjodahl - dunceor 
> > > > > wrote:
> > > > >
> > > > > > Hello.
> > > > > >
> > > > > > I'm having problems with the silc port.
> > > > > >
> > > > > > If I run silc I get this
> > > > > >
> > > > > > $ silc
> > > > > > Running SILC for the first time
> > > > > > Private key passphrase:
> > > > > > Retype private key passphrase: Floating point exception (core 
> > > > > > dumped)
> > > > > > $
> > > > > >
> > > > > > This is on amd-64, OpenBSD 4.2-current (as of yesterday).
> > > > > >
> > > > > > I also downloaded silc-client from silcnet.org and build 1.1.3 from
> > > > > > source and it's the same problem.
> > > > > >
> > > > > > Anybody seen this problem and know how to solve it?
> > > > > >
> > > > > > Please cc me, I'm not member of ports.
> > > > > >
> > > > > > BR
> > > > > > dunceor
> > > > >
> > > > > My guess is this is caused by using the 128 bits arithmetic types in
> > > > > w-silc-client-1.1.2/silc-client-1.1.2/lib/silcmath/tma.h:
> > > > >
> > > > >    typedef unsigned long      tma_mp_word __attribute__ ((mode(TI)));
> > > > >
> > > > >         -Otto
> > > > >
> > > > >
> > > >
> > > > Hello.
> > > > It look like that is indeed the reason for the problem.
> > > > Any suggestion how to fix it? I haven't had time to look at it more
> > > > closely so I don't know what it takes to fix it.
> > > > It this releated to AMD64, can't it handle those 128bit stuff?
> > > > Is it anything that has come in on AMD64 that is related to this or
> > > > why hasn't it showed up before (I ran like 1.0.1 before I upgraded to
> > > > 4.2-current without problem).
> > >
> > > The 128 bits arithmetic _should_ work, I'll have to investate further.
> > > There is a (slight) possibility that rev 1.13 of
> > > sys/arch/amd64/amd64/fpu.c has something to do with it.
> > >
> > > You could try reverting and see what happens.
> > >
> > >       -Otto
> >
> > In the meantime I found out the problem is specific to the
> > key-generation code on amd64. Once you have a keypair (I generated one
> > on i386), it seems amd64 works.  Debugging shows the code actually
> > does an (integer) divide by zero (due to historic reasons this
> > generates a FP exception).  Why the div by zero happens on amd64 I do
> > not know yet.
> >
> >         -Otto
> >
> >
> 
> Hello.
> Yeah it worked if I took my old backed up keys.
> I may have time to test in the weekend if it was the fpu.c change that
> did it but it looks like a candidate.
> Thanks so much for the help!
> 
> BR
> dunceor

the recent fpu.c commit did not make a difference here.

mode(TI) division seems pretty broken on amd64.

Try this, compile with -O2, it core dumps in __udivti3. If -O2 is not
used, it does not core, but the result produced is not right.

#include <stdio.h>
typedef unsigned long      tma_mp_word __attribute__ ((mode(TI)));

main()
{
        tma_mp_word b, w, z;

        w = 1;
        b = 1;
        z = w / b;
        printf("%x\n", (int) z);
}

[EMAIL PROTECTED]:5]$ cc x.c     
[EMAIL PROTECTED]:6]$ ./a.out
fffe7df8
[EMAIL PROTECTED]:7]$ cc  -O2 -g x.c
[EMAIL PROTECTED]:8]$ gdb ./a.out
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-unknown-openbsd4.2"...
(gdb) run 
Starting program: /home/otto/a.out 

Program received signal SIGFPE, Arithmetic exception.
0x00000000004009cc in __udivti3 (n=0x00000000004005550000000000000001, 
    d=0x00000000004005550000000000000001)
        at /usr/src/gnu/usr.bin/gcc/gcc/libgcc2.c:597
        597                 d0 = 1 / d0;        /* Divide intentionally by 
zero.  */
(gdb) 

Reply via email to