From: "Jonathan Saxton" <jsaxton@appsecinc.com>
To: <gcc-help@gcc.gnu.org>
Subject: gcc 4.2.x large file support
Date: Wed, 07 May 2008 21:06:00 -0000 [thread overview]
Message-ID: <001f01c8b075$43776720$351110ac@nycapt35k.com> (raw)
In-Reply-To: <482160AD.40504@transitive.com>
I think I have found a problem in the g++ header files concerning large file
support. I have seen it on two different AIX machines, one running AIX 5.3
and using gcc 4.1.2, the other running AIX 5.2 and using a slightly later
version of gcc, namely 4.2.2.
cstdio carefully #undefs all the routines in stdio.h and then issues a
"using" directive for each. The problem is that when large file support is
enabled, routines like fgetpos() have been remapped to the 64-bit
equivalents, fgetpos64() in this example.
From stdio.h:
#ifdef _LARGE_FILES
#define fgetpos fgetpos64
#endif
#ifdef _LARGE_FILE_API
extern int fgetpos64(FILE *, fpos64_t *);
#endif
Then cstdio does
#undef fgetpos
and later ...
using ::fgetpos;
which yields a compilation error because there is no such routine.
The following source code illustrates the problem.
testio.cpp
==========
#include <cstdio>
int main(int argc, char *argv[])
{
FILE
*ff;
ff = fopen("grober.nix", "w");
if (ff == 0)
{
puts("File open failed");
}
else
{
fprintf(ff, "To a %s, happiness is a warm %s\n",
"maggot", "cowpat");
fclose(ff);
}
return 0;
}
When compiled with:
g++ testio.cpp
no error is elicited and the program (a.out) does what is expected.
Compiling with
g++ -D_LARGE_FILES testio.cpp
yields
In file included from testio.cpp:1:
/opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/include/c++/cstdio:109:
error: '::fgetpos' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/include/c++/cstdio:111:
error: '::fopen' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/include/c++/cstdio:116:
error: '::freopen' has not been declared
/opt/freeware/lib/gcc/powerpc-ibm-aix5.2.0.0/4.2.2/include/c++/cstdio:119:
error: '::fsetpos' has not been declared
testio.cpp: In function 'int main(int, char**)':
testio.cpp:8: error: 'fopen' was not declared in this scope
All the routines listed in the error messages are subject to the 64-bit
remapping done by stdio.h and broken by cstdio.
Now I tried the same thing on some other platforms, namely
HPUX ia64 g++ 4.2.2
HPUX parisc g++ 4.2.2
Linux x86_64 g++ 3.4.5
Linux x86 g++ 3.4.6
and none of those exhibited the problem described above. I confess that I
do not know why, and it suggests that either my analysis is flawed or the
large file support is not being used by C++ programs on those platforms.
(I noted that _LARGE_FILES and _LARGE_FILE_API are disjoint but I did not
spend any time trying to figure out why.)
next prev parent reply other threads:[~2008-05-07 19:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-06 14:27 GCC 4.3.0 configure failure: libgcc James Molloy
2008-05-06 23:25 ` Ralf Wildenhues
2008-05-07 8:16 ` James Molloy
2008-05-07 21:06 ` Jonathan Saxton [this message]
2008-05-08 7:31 ` gcc 4.2.x large file support Michael Haubenwallner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001f01c8b075$43776720$351110ac@nycapt35k.com' \
--to=jsaxton@appsecinc.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).