Hi,

At Fri, 8 Mar 2002 18:19:40 +0900,
Jonathan Baker wrote:
> Discovered that the patch for large files caused a nasty side effect:
> any use of backquotes (%x) results in a seg fault.  :(  The fix is
> simple, but very strange: just include a prototype declaration for
> io_fread in io.c:
> 
>   static long io_fread _((char *, long, FILE *));
> 
> and all is well.  I've updated the patch to include this, see
> http://www.jonathanbaker.org/software/ruby/ruby.html.
> 
> Without the prototype, just before this call in read_all in io.c:
> 
>   n = io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f);

Because you changed siz to off_t, 64bit integer is passed to
read_all() without the prototype.

> the fptr->f is fine, but somehow it mysteriously becomes NULL
> immediately after entering io_fread.  Seems rather like a compiler
> bug, unless I'm overlooking something silly.  I get the same behavior
> on multiple platforms using gcc 2.96.  Anyone understand this?

And you must use little-endian system, thus higher 32bit is
used as FILE*.

I guess it's better to change 2nd argument of io_fread() to
off_t.

-- 
Nobu Nakada