Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Building current
On Sun, Apr 07, 2013 at 12:19:00PM +0200, Martin Husemann wrote:
> Why it ends up wrong there is not that easy to see, still looking.
> (Could be a libc bug, maybe even vax specific, could be gcc, whatever)
It is the initialization of masks in initscan().
The following program shows the bug:
#include <stdio.h>
#include <inttypes.h>
int main(int argc, char **argv)
{
size_t i;
uint64_t v, nv;
for (i = 0; i < 16; i++) {
v = ~(uint64_t)0 << i;
nv = ~v;
printf("%zu: mask %08llx not %08llx\n", i, v, nv);
}
return 0;
}
It produces on vax:
0: mask ffffffff not ffffffff00000000
1: mask 1fffffffe not fffffffe00000001
2: mask 3fffffffc not fffffffc00000003
3: mask 7fffffff8 not fffffff800000007
4: mask ffffffff0 not fffffff00000000f
5: mask 1fffffffe0 not ffffffe00000001f
6: mask 3fffffffc0 not ffffffc00000003f
instead of:
0: mask fffffffffffff not 00000000
1: mask ffffffffffffe not 00000001
2: mask ffffffffffffc not 00000003
...
The code generated is:
.globl main
.type main, @function
main:
.word 0x40
subl2 $4,%sp
clrl %r6
.L2:
ashq %r6,$-1,%r2
mcoml %r2,%r0
mcoml %r3,%r1
movq %r0,-(%sp)
movq %r2,-(%sp)
pushl %r6
pushab .LC0
calls $6,printf
incl %r6
cmpl %r6,$16
jneq .L2
clrl %r0
ret
Martin
Home |
Main Index |
Thread Index |
Old Index