libstdc++/4886: Solaris largefile support for fopen removed by include/g++-v3/bits/std_cstdio.h
alex@softgrow.com
alex@softgrow.com
Sun Nov 4 13:25:00 GMT 2001
>Number: 4886
>Category: libstdc++
>Synopsis: Solaris largefile support for fopen removed by include/g++-v3/bits/std_cstdio.h
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 15 16:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Wilf Kruggel
>Release: unknown-1.0
>Organization:
>Environment:
Solaris 8.0
gcc 3.0.2
>Description:
When compiling on Solaris for files > 2 Gigs the flag -D_FILE_OFFSET_BITS=64 and -D_LARGEFILE_SOURCE cause the Solaris supplied /usr/include/stdio.h to create define fopen as fopen64 using a macro.
This macro is undefined by the gcc include/g++-v3/bits/.std_cstdio.h
Thus any attempt to open a largefile in compiled code will fail on execution with an error "Value too large for defined data type". Truss will show fopen being called rather than fopen64.
>How-To-Repeat:
Try the following code on a large file > 2 Gigs
g++ `LFS_CLFAGS` -o junk junk.c
#include <cstdio>
main()
{
FILE *fp = fopen("reallybigfile.gen","rb");
if (fp==NULL) perror("fopen");
}
You will get when you run
fopen: Value too large for defined data type
>Fix:
remove "#undef fopen" (and same for fgetpos, freopen, fsetpos) in std_cstdio.h but this may break something else.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list