Subject: bug#2790: emacs 22.1.1 cannot open 5GB file on
64GB 64-bit GNU/Linux box

The smallest file that produces the error has 536870912 bytes, exactly
512MB. (This is via binary search, so assumes that there is just one
transition from "will" to "won't" as filesize increases.)

It looks like you're simply hitting the limit on buffer size.

But I suspect there is a bug here, because it sounds like
you can visit a file whose size is bigger than most-positive-fixnum.
If you do that, what value do you get for (point-max)?
Is it negative? I think it will be, and that we need
to restrict the buffer size to be no more than most-positive-fixnum.