public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Ronald Van Iwaarden <vaniwaar@ca.metsci.com>
To: paolo@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c++/5298: stream::write
Date: Tue, 08 Jan 2002 10:06:00 -0000	[thread overview]
Message-ID: <20020108180600.4880.qmail@sources.redhat.com> (raw)

The following reply was made to PR c++/5298; it has been noted by GNATS.

From: Ronald Van Iwaarden <vaniwaar@ca.metsci.com>
To: <paolo@gcc.gnu.org>,  <gcc-bugs@gcc.gnu.org>,  <gcc-prs@gcc.gnu.org>, 
     <nobody@gcc.gnu.org>,  <paolo@gcc.gnu.org>,  <ron@vaniwaarden.org>, 
     <vaniwaar@ca.metsci.com>,  <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c++/5298: stream::write
Date: Tue, 8 Jan 2002 09:59:26 -0800 (PST)

 This solved the symptom I described but there is still some funkiness
 going on.  Now, I know what I am describing here is not well defined
 behavior but if take the following program an run it, it always gives
 the same output (up to the order of the lines).  That is, every line is
 printed correctly, but they may come in different orders.  However, if
 you redirect the output to a file, sometimes the output of lines gets
 merged.  I never noted this behavior on the 2.96 compiler...
 
 
 int main()
 {
   std::ios::sync_with_stdio(false);
   int pid= fork();
 
   if (pid){
     cout<<0<<"ARG CALLED: Kind ID = "<<1<<", Data = data "<<endl;
     cout<<2<<"ARG CALLED: Kind ID = "<<1<<", Data = data "
 	<< "p1 = "<<12<<", "<<"p2 = "<<34<<", "<<endl;
     cout<<4<<"ARG CALLED: Kind ID = "<<1<<", Data = data "
 	<< "p1 = "<<12<<", "<<"p2 = "<<34<<", "<<"p3 = "<<56<<", "
 	<<"p4 = "<<78<<", "<<endl;
     cout<<6<<"ARG CALLED: Kind ID = "<<0<<", Data = data "
 	<< "p1 = "<<12<<", "<<"p2 = "<<34<<", "<<"p3 = "<<56<<", "
 	<<"p4 = "<<78<<", "<<"p5 = "<<90<<", "<<"p6 = "<<12<<", "<<endl;
     cout<<8<<"ARG CALLED: Kind ID = "<<0<<", Data = data "
 	<< "p1 = "<<12<<", "<<"p2 = "<<34<<", "<<"p3 = "<<56<<", "
 	<<"p4 = "<<78<<", "<<"p5 = "<<90<<", "<<"p6 = "<<12<<", "
 	<<"p7 = "<<34<<", "<<"p8 = "<<56<<", "<<endl;
   }
   else{
     cout<<1<<"ARG CALLED: Kind ID = "<<1<<", Data = data "
 	<< "p1 = "<<12<<", "<<endl;
     cout<<3<<"ARG CALLED: Kind ID = "<<1<<", Data = data "
 	<< "p1 = "<<12<<", "<<"p2 = "<<34<<", "<<"p3 = "<<56<<", "
 	<<endl;
     cout<<5<<"ARG CALLED: Kind ID = "<<0<<", Data = data "
 	<< "p1 = "<<12<<", "<<"p2 = "<<34<<", "<<"p3 = "<<56<<", "
 	<<"p4 = "<<78<<", "<<"p5 = "<<90<<", "<<endl;
     cout<<7<<"ARG CALLED: Kind ID = "<<0<<", Data = data "
 	<< "p1 = "<<12<<", "<<"p2 = "<<34<<", "<<"p3 = "<<56<<", "
 	<<"p4 = "<<78<<", "<<"p5 = "<<90<<", "<<"p6 = "<<12<<", "
 	<<"p7 = "<<34<<", "<<endl;
   }
 }
 
 run "./a.out > ff; cat ff | sort" and, if run multiple times, you get
 different output.  Note that you get exactly the same output every time
 if you do "./a.out | sort".
 
 Hmmm.  Sorry for the sort of funky description and example...
 
 --Ron
 On 7 Jan 2002 paolo@gcc.gnu.org wrote:
 
 > Synopsis: stream::write
 >
 > Responsible-Changed-From-To: unassigned->paolo
 > Responsible-Changed-By: paolo
 > Responsible-Changed-When: Mon Jan  7 14:15:59 2002
 > Responsible-Changed-Why:
 >     Analyzed.
 > State-Changed-From-To: open->feedback
 > State-Changed-By: paolo
 > State-Changed-When: Mon Jan  7 14:15:59 2002
 > State-Changed-Why:
 >     Hi again Ron!
 >     This one should be easier to solve (I hope): could you
 >     please try adding a:
 >     std::ios::sync_with_stdio(false);
 >     at the beginning of your main?
 >     It works for me (gcc3.0.3 on i686-pc-linux-gnu).
 >
 >     Cheers,
 >     Paolo.
 >
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5298
 >
 
 -- 
 --------------------------------------------------------------------------------
 Ronald Van Iwaarden - Metron Inc. (719)567-9873
 
 main(i){(10-putchar(((25208>>3*(i+=3))&7)+(i?i-4?100:65:10)))?main(i-4):i;}
 
 
 


             reply	other threads:[~2002-01-08 18:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-08 10:06 Ronald Van Iwaarden [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-01-08  9:51 paolo
2002-01-07 14:16 paolo
2002-01-07  7:16 ron

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=20020108180600.4880.qmail@sources.redhat.com \
    --to=vaniwaar@ca.metsci.com \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=paolo@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).