public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: anderson@ligo.caltech.edu
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/5396: ifstream read()'s data multiple times on Solaris
Date: Tue, 15 Jan 2002 15:06:00 -0000	[thread overview]
Message-ID: <20020115225617.18917.qmail@sources.redhat.com> (raw)


>Number:         5396
>Category:       libstdc++
>Synopsis:       ifstream read()'s data multiple times on Solaris
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 15 15:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Stuart Anderson
>Release:        gcc-3.0.3
>Organization:
>Environment:
SunOS XXX 5.8 Generic_108528-12 sun4u sparc SUNW,Ultra-60
>Description:
The following simple code to read a file using ifstream
results in the following system call chain on Solaris 8
with gcc-3.0.x,

read(8k) lseek(1k absolute) read(8k) lseek(2k absolute) ...

rather than the following from gcc-2.95.3,

read(8k) read(8k) read(8k) ...

Note in the gcc-3.0.x case there are 8 times more
calls to read() than for gcc-2.95.3!

This bug does not occur on a RedHat7.2 machine with
gcc-3.0.3, and has been reproduced on Solaris with
gcc-3.0.1, 3.0.2, and 3.0.3.

The resulting performance hit prevents our project
from using gcc-3.0.x.
>How-To-Repeat:
truss ./a.out /dev/zero

after compiling,

#include<iostream>
#include<fstream>
main(int argc, char *argv[]){
std::cerr << "foo" << std::endl;
std::ifstream in(argv[1]);
for(int i = 0; i < 100; i++){
char data[1024];
in.read(data,1024);
}
}

Here is a section of the truss output that shows the problem:

open("/dev/zero", O_RDONLY)                     = 3
fstat64(3, 0xFFBEF2E0)                          = 0
brk(0x00033140)                                 = 0
brk(0x00035140)                                 = 0
ioctl(3, TCGETA, 0xFFBEF26C)                    Err#6 ENXIO
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0".., 8192)     = 8192
lseek(3, 0xFFFFE000, SEEK_CUR)                  = 0
llseek(3, 0, SEEK_CUR)                          = 0
lseek(3, 1024, SEEK_CUR)                        = 1024
llseek(3, 0, SEEK_CUR)                          = 1024
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0".., 8192)     = 8192
lseek(3, 0xFFFFE000, SEEK_CUR)                  = 1024
llseek(3, 0, SEEK_CUR)                          = 1024
lseek(3, 1024, SEEK_CUR)                        = 2048
llseek(3, 0, SEEK_CUR)                          = 2048
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0".., 8192)     = 8192
lseek(3, 0xFFFFE000, SEEK_CUR)                  = 2048
llseek(3, 0, SEEK_CUR)                          = 2048
lseek(3, 1024, SEEK_CUR)                        = 3072
llseek(3, 0, SEEK_CUR)                          = 3072
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0".., 8192)     = 8192
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-01-15 23:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-15 15:06 anderson [this message]
2002-04-03 18:32 pme
2002-04-11 18:26 Richard Henderson
2002-04-12  8:16 Stuart Anderson
2002-04-12  9:56 Richard Henderson
2002-04-12 11:36 Stuart Anderson
2002-04-20  5:36 Craig Rodrigues
2002-04-20  5:46 Craig Rodrigues
2002-04-20  5:56 Craig Rodrigues
2002-04-23  5:25 jason

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=20020115225617.18917.qmail@sources.redhat.com \
    --to=anderson@ligo.caltech.edu \
    --cc=gcc-gnats@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).