Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-24 Thread erik quanstrom
> Is this behaviour really useful for anything? Is there > anything in plan9 code that relies on this behaviour in a > critical way? I suspect this rule can be changed without > impacting plan 9 code much (which as a rule is of much higher > quality than most open source code) and we already know >

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-24 Thread Charles Forsyth
>but c89 rules do seem a bit more sensible to me as they avoid surprises have you read the rules?

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-24 Thread Bakul Shah
On Fri, 23 Apr 2010 18:34:56 EDT erik quanstrom wrote: > > On Fri, Apr 23, 2010 at 1:08 PM, Bakul Shah wro > te: > > > > > > > > If so, I consider it a bug; particularly as there is no > > > overflow involved anywhere. > > > > > > > > > > r1 2147482110 r2 -1537 > > on arm the difference is i

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-23 Thread erik quanstrom
> On Fri, Apr 23, 2010 at 1:08 PM, Bakul Shah wrote: > > > > > If so, I consider it a bug; particularly as there is no > > overflow involved anywhere. > > > > > > r1 2147482110 r2 -1537 on arm the difference is interesting. the first / is translated: main+0x20 0x1040MOVW(R4

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-23 Thread erik quanstrom
> On Fri, Apr 23, 2010 at 1:08 PM, Bakul Shah wrote: > > > > > If so, I consider it a bug; particularly as there is no > > overflow involved anywhere. > > > > > > r1 2147482110 r2 -1537 that's be 0 for 2. the expected answer is 1543. same answer on arm. acid: (1234 - 4321)/2\D -1543 - erik

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-23 Thread ron minnich
On Fri, Apr 23, 2010 at 1:08 PM, Bakul Shah wrote: > > If so, I consider it a bug; particularly as there is no > overflow involved anywhere. > > r1 2147482110 r2 -1537 ron

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-23 Thread Bakul Shah
On Fri, 23 Apr 2010 19:53:24 BST C H Forsyth wrote: > >As per C89 in this case the unsigned char value should be > >promoted to a *signed* int value. The sum will be of type > >signed int and so the division will do the right thing. In > >kencc case it seems the sum has type unsigned int for som

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-23 Thread tlaronde
On Fri, Apr 23, 2010 at 07:53:24PM +0100, C H Forsyth wrote: > > on 19 April, I wrote: > >notably the compiler doesn't implement the value-preserving rules for > >comparisons. ... > >instead the compiler implements the older unsigned-preserving rule It's a chance I was working with a software as

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-23 Thread C H Forsyth
>As per C89 in this case the unsigned char value should be >promoted to a *signed* int value. The sum will be of type >signed int and so the division will do the right thing. In >kencc case it seems the sum has type unsigned int for some >reason and further, the signed divisor (2) is promoted to a

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-23 Thread tlaronde
On Thu, Apr 22, 2010 at 03:49:11PM -0700, Bakul Shah wrote: > On Thu, 22 Apr 2010 23:15:51 +0200 tlaro...@polynum.com wrote: > > This is: signed long + signed long + unsigned char. > > > Do you mean that there is first promotion : > > > > 1) unsigned char is promoted to unsigned int (A6.1).

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread Bakul Shah
On Thu, 22 Apr 2010 23:15:51 +0200 tlaro...@polynum.com wrote: > This is: signed long + signed long + unsigned char. > Do you mean that there is first promotion : > > 1) unsigned char is promoted to unsigned int (A6.1). As per C89 in this case the unsigned char value should be promoted to

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread tlaronde
On Thu, Apr 22, 2010 at 11:15:51PM +0200, tlaro...@polynum.com wrote: > > I get: > > gcc: -201 > ken-cc: 2147483447 (2^31 - 201) > > This is: signed long + signed long + unsigned char. > > Do you mean that there is first promotion : > > 1) unsigned char is promoted to unsigned int (A6.1)

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread tlaronde
Bingo! see below... On Thu, Apr 22, 2010 at 01:07:40PM -0700, Bakul Shah wrote: > On Thu, 22 Apr 2010 21:32:36 +0200 tlaro...@polynum.com wrote: > > On Thu, Apr 22, 2010 at 03:08:40PM -0400, ge...@plan9.bell-labs.com wrote: > > > What type is `smallnumber'? > > > > typedef unsigned char smallnum

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread Bakul Shah
On Thu, 22 Apr 2010 21:32:36 +0200 tlaro...@polynum.com wrote: > On Thu, Apr 22, 2010 at 03:08:40PM -0400, ge...@plan9.bell-labs.com wrote: > > What type is `smallnumber'? > > typedef unsigned char smallnumber; Aha! > translated from Pascal: > > small_number=0..63; IIRC in

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread tlaronde
On Thu, Apr 22, 2010 at 03:08:40PM -0400, ge...@plan9.bell-labs.com wrote: > What type is `smallnumber'? typedef unsigned char smallnumber; translated from Pascal: small_number=0..63; -- Thierry Laronde http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE9

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread geoff
What type is `smallnumber'?

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread tlaronde
Oups, I sent the version with the modifications applied (enrolling). Here is the vanilla version (with reformating): void makemoves( scaled xx0 , scaled xx1 , scaled xx2 , scaled xx3 , scaled yy0 , scaled yy1 , scaled yy2 , scaled yy3 , smallnumber xicorr , smallnumber etacorr )

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread tlaronde
On Thu, Apr 22, 2010 at 10:03:58AM -0700, Bakul Shah wrote: > > What is the type of x1 and x2? Can you show an actual C code > fragment? Don't worry about it being complete. Just the half() All are "integer" (in WEB -> Pascal ->) #define integer long The half() macro is only this: #define hal

Re: [9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread Bakul Shah
On Thu, 22 Apr 2010 17:29:53 +0200 tlaro...@polynum.com wrote: > Data: > Under NetBSD/gcc, I have the following values: > > before: x1:=5440, x2:=-5843, x3:=78909 > after: x1:=5440, x2:=-201, x3:=18166, r:=6827 t:=30232 > > Under Plan9/gcc, I have the following values: > > bef

[9fans] BUG!!! in Plan9 compiler!

2010-04-22 Thread tlaronde
So I have finally narrow down and compare the calculus under NetBSD/i386/gcc and Plan9/i386/ken-cc. And this has nothing to do with div versus shift... ken-cc is at fault here and it seems deep; it has apparently to deal with registerization. Data: Under NetBSD/gcc, I have the following values: