Bug 21276

Summary: libI77 is unable to handle files >2Gbytes
Product: Base System Reporter: vazquez <vazquez>
Component: gnuAssignee: Alexander Kabaev <kan>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
diff none

Description vazquez 2000-09-14 23:10:01 UTC
libI77 is unable to handle files greater than 2147627376 bytes (2G),
this makes the g77 (and f2c/gcc too on the latest freebsd versions )
generated binaries unable to deal with large quantum chemistry
calculations, for example

Fix: 

I'm not sure but it seems this bug may be related to this modification:

/usr/src/contrib/libf2c/libI77/Version.c

/* 19 Jan. 1998: backspace.c: for b->ufmt==0, change sizeof(int) to
                 sizeof(uiolen).  On machines where this would make a
                 difference, it is best for portability to compile libI77 with
                 -DUIOLEN_int (which will render the change invisible). */


According to 
/usr/src/contrib/libf2c/libI77/README.netlib

Unformatted sequential records consist of a length of record
contents, the record contents themselves, and the length of
record contents again (for backspace).  Prior to 17 Oct. 1991,
the length was of type int; now it is of type long, but you
can change it back to int by inserting

#define UIOLEN_int

at the beginning of fio.h.  This affects only sue.c and uio.c .

I'm not an expert on the recent Make buildworld structure to follow
all steps from the import of libf2c into egcs to trace this problem
but I believe somewhere from 1996 to now something was changed
and limited the IO routines to 2G.
How-To-Repeat: 
Try to create a file bigger than 2G using fortran.
Run any big quantum chemistry ab-initio calculation , I've
old binaries (from 1996) of gaussian (www.gaussian.com)
compiled on FreeBSD2.x that run fine with big files, I found
this when building new binaries with FreeBSD4.x
Comment 1 vazquez 2000-10-09 14:44:40 UTC
The following patch allows random direct access files bigger than >2Gbytes
on FreeBSD/x86, it applies against the netlib libI77 sources. To integrate
this on gcc would require that autoconf tests all the 32 bit target archs
for:
	1) The presence of fseeko/ftello or fseek64/ftell64 or...
	the appropriate pair of 64bit off_set functions;
	2) What argument these functions use: off_t, 'long long';
	3) Other targets (16bit, 64bit, linux/x86) should be left
	untouched (that is, it seems this patch is specific to *BSD intel)

an alternative way would be to submit these patchs to David Gay at
Bell (the f2c/lib*77 mantainer) and hope this will be imported on
gcc sometime and from there into FreeBSD tree.

Pedro

Comment 2 Mark Valentine 2002-05-13 02:08:30 UTC
This bug was apparently introduced with the import of contrib/f2c.

Recently the gcc 3.1 version of f2c was imported into FreeBSD 5.0-CURRENT;
this version appears to address at least part of this issue with the use
of off_t instead of long.

		Cheers,

		Mark.

-- 
Mark Valentine, Thuvia Labs <mark@thuvia.co.uk>       <http://www.thuvia.co.uk>
"Tigers will do ANYTHING for a tuna fish sandwich."       Mark Valentine uses
"We're kind of stupid that way."   *munch* *munch*        and endorses FreeBSD
  -- <http://www.calvinandhobbes.com>                  <http://www.freebsd.org>
Comment 3 Kris Kennaway freebsd_committer freebsd_triage 2003-07-13 01:21:39 UTC
Responsible Changed
From-To: freebsd-bugs->kan

Assign to gcc maintainer
Comment 4 Alexander Kabaev freebsd_committer freebsd_triage 2003-11-13 22:57:56 UTC
State Changed
From-To: open->closed

Fixed in GCC 3.x series. GCC 2.95.x is closed for development.