This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/8610: std::streamoff type is 32-bit in GCC 3.2whereas it was 64-bit in GCC 2.96
- From: Andreas Jaeger <aj at suse dot de>
- To: paolo at gcc dot gnu dot org
- Cc: davido at csse dot uwa dot edu dot au, gcc-bugs at gcc dot gnu dot org,gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Sat, 08 Feb 2003 22:28:03 +0100
- Subject: Re: libstdc++/8610: std::streamoff type is 32-bit in GCC 3.2whereas it was 64-bit in GCC 2.96
- References: <20030208203156.12574.qmail@sources.redhat.com>
paolo@gcc.gnu.org writes:
> Synopsis: std::streamoff type is 32-bit in GCC 3.2 whereas it was 64-bit in GCC 2.96
>
> Responsible-Changed-From-To: unassigned->aj
> Responsible-Changed-By: paolo
> Responsible-Changed-When: Sat Feb 8 20:31:56 2003
> Responsible-Changed-Why:
> LFS expert.
> State-Changed-From-To: open->analyzed
> State-Changed-By: paolo
> State-Changed-When: Sat Feb 8 20:31:56 2003
> State-Changed-Why:
> Hi Andreas, could you please have a look at this PR?
> It's about large file support in Linux and, having browsed
> your page
> http://www.suse.de/~aj/linux_lfs.html
> I think you can answer it _much_ better than me!
> Thanks, Paolo.
Paolo, I need some help here since I don't know the internals of
libstc++.
/opt/gcc/3.4-devel/include/c++/3.4/i686-pc-linux-gnu/bits/c++io.h
(where does this file come from?) indeed defines:
namespace std
{
// for fpos.h
typedef long streamoff;
typedef ptrdiff_t streamsize; // Signed integral type
And libstdc++/config/io/c_io_libio.h has:
namespace std
{
// from fpos.h
typedef _IO_ssize_t streamsize; // Signed integral type
typedef _IO_ssize_t wstreamsize;
#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
typedef _IO_off64_t streamoff;
typedef _IO_fpos64_t __c_streampos;
#else
typedef _IO_off_t streamoff;
typedef _IO_fpos_t __c_streampos;
#endif
For Linux we should IO_IO_FILE_VERSION defined and set to 0x20001.
But why is this not done?
But the problem is even more subitle. config/io/basic_file_stdio.cc
uses fseek/ftell which use a long int and therefore - under 32-bit -
allow only 2 GB. You should use fseeko/ftello or fsetpos/fgetpos.
Paolo, does this help? Or did I look at the wrong files?
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj