Subject: bin/3902: gcc doesn't promote correctly to (off_t)
To: None <gnats-bugs@gnats.netbsd.org>
From: Ignatios Souvatzis <ignatios@cosinus.cs.uni-bonn.de>
List: netbsd-bugs
Date: 07/22/1997 14:33:58
>Number: 3902
>Category: bin
>Synopsis: gcc doesn't promote correctly to (off_t)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 22 05:35:01 1997
>Last-Modified:
>Originator: Ignatios Souvatzis
>Organization:
computer science department, university of Bonn, Germany
>Release: last thursday
>Environment:
System: NetBSD cosinus.cs.uni-bonn.de 1.2G NetBSD 1.2G (COSINUS) #64: Fri Jul 18 12:32:54 MEST 1997 ignatios@cosinus.cs.uni-bonn.de:/usr/obj.i386/kernel/COSINUS i386
>Description:
gcc promotes -sizeof(cbuf) (where cbuf is a small structure) in a way that
reed(fd, &cbuf, sizeof(cbuf));
lseek(fd, -sizeof(cbuf), SEEK_CUR);
seeks to 148+2^32-148 instead of back to 0.
Casting to (off_t) doesn't help.
lseek(fd, (off_t)-sizeof(cbuf), SEEK_CUR);
Casting to (long) helps:
lseek(fd, (long)-sizeof(cbuf), SEEK_CUR);
First casting to (off_t), then taking the negative value works:
lseek(fd, -(off_t)sizeof(cbuf), SEEK_CUR);
ktrace excerpt for non-working (all same):
2358 rc5client CALL lseek(0x3,0,0xffffff6c,0,0x1)
ktrace excerpt for working:
261 rc5client CALL lseek(0x3,0,0xffffff6c,0xffffffff,0x1)
>How-To-Repeat:
Try to compile & run the Finnish rc5 team's rc5client.c.
Wonder why it computes the same keyblock over and over again.
Wonder why the cache file is 4294967444 bytes long, instead of 8880.
>Fix:
If I knew how, I'd fix it.
>Audit-Trail:
>Unformatted: