Bug 20504

Summary: iostream + pthreads = breakage (already fixed in rawhide)
Product: [Retired] Red Hat Linux Reporter: Need Real Name <oneill>
Component: libstdc++Assignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-11-08 01:14:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Need Real Name 2000-11-08 01:14:21 UTC
The enclosed code hangs after printing "In parent" with *-2.96-54,
but works fine with *-2.96-60.  Since no compiler update has been
issued for Red Hat 7, I figured I should report it as a bug.

    M.E.O.

Enc.

rh7% cat buggy.cc
#include <pthread.h>
#include <iostream>

void * child_fn(void *) {
    cout << "In child" << endl;
    return 0;
}

int main() {
    cout << "In parent" << endl;
    pthread_t child_tid;
    if (pthread_create(&child_tid, 0, child_fn, 0) == 0) {
        pthread_join(child_tid, 0);
    }
}

rh7% g++ -D_REENTRANT -Wall -o buggy buggy.cc -lpthread
rh7% buggy
In parent
^C
rh7%

Comment 1 Jakub Jelinek 2000-11-08 13:30:33 UTC
We will issue an official errata once a couple of outstanding issues are
resolved. In the meantime use the rawhide packages, the official errata will
be their successor.

Comment 2 Rene van Paassen 2000-12-13 16:35:10 UTC
The bug is still (or again) there in gcc-2.96-65 
Is there some way to get 2.96-60 somewhere?

I was struggling with the same problem. An awkward fix is calling unlock(cout)
after all writes. 


Comment 3 Jakub Jelinek 2000-12-13 17:05:19 UTC
No, the bug is not in libstdc++-2.96-65.
Make sure you upgrade libstdc++ and libstdc++-devel as well as gcc*-2.96-65*.