Hello,
I am using kernel 2.2.17pre2 with the LFS patch from
http://www.scyld.com/software/lfs.html, gcc 2.95.2, and libc6 2.1.3 on a
SMP PentiumII.
The following code causes 'stat' to return incorrect values when
compiled with -malign-double:
--------
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]){
struct stat mystat;
printf("\nreturn = %d\n", stat(argv[1], &mystat));
printf(" size = %lld\n\n", mystat.st_size);
exit(0);
}
--------
The file that I am testing on is of size 2800102912 bytes (although the
file size doesn't seem to matter -- incorrect values are returned for
small and/or large files)
Simply adding the -malign-double flag changes the results:
presto:~$ gcc -g -O -D_FILE_OFFSET_BITS=64 -o teststat teststat.c
presto:~$ ./teststat /raid/data/Ter5_Raw/Ter5_3.raw
return = 0
size = 2800102912
presto:~$ gcc -g -O -D_FILE_OFFSET_BITS=64 -malign-double -o teststat
teststat.c
presto:~$ ./teststat /raid/data/Ter5_Raw/Ter5_3.raw
return = 0
size = 17592186044416
Any idea if this is a gcc bug or a LFS/kernel bug?
Thanks,
Scott
PS: I am using the stock glibc 2.1.3.
-- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 495-4142 60 Garden St. MS 10 email: ransom@cfa.harvard.edu Cambridge, MA 02138 PGP Fingerprint: D2 0E D0 10 CD 95 06 DA EF 78 FE 2B CB 3A D3 53- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:12 EST