This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I noticed that rcp'ing from an sh4-linux system always fails for me, and tracked down the problem to a line in inetutils-1.4.2/rcp/util.c: size = ((((((stb).st_blksize > 0 ? (stb).st_blksize : 512))+((blksize)-1))/(blksize))*(blksize)); When st_blksize was 4096, and blksize was 8192, this was setting size to 2^31 or so. It was quite flaky; executing printf("") just prior to the function containing the bad code, or adding print statements into the function containing the bad code (even if after the bad code) made the problem go away.
The problem occurs with both a gcc-2.97 snapshot, and with vanilla gcc-3.0.2, but doesn't seem to happen anymore with gcc-3.2.3.
Just thought I'd mention it here in case anyone else was trying to bring up rcp on an sh4 system with an old compiler :-) The following patch seems to work around the problem for me. It should probably be rewritten to use and's and or's rather than div and mult, but I just did a quick fix. - Dan
--- inetutils-1.4.2/rcp/util.c.old Tue Jul 8 11:38:47 2003 +++ inetutils-1.4.2/rcp/util.c Tue Jul 8 11:40:03 2003 @@ -130,6 +130,11 @@ return (status); }
+static size_t froundup(size_t x, size_t y) +{ + return (((x+(y-1))/y)*y); +} + BUF * allocbuf(BUF *bp, int fd, int blksize) { @@ -140,10 +145,7 @@ run_err("fstat: %s", strerror(errno)); return (0); } -#ifndef roundup -# define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#endif - size = roundup(ST_BLKSIZE(stb), blksize); + size = froundup(ST_BLKSIZE(stb), blksize); if (size == 0) size = blksize; if (bp->cnt >= size)
-- Dan Kegel http://www.kegel.com http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |