Bug 816

Summary: egcs pthread bug
Product: [Retired] Red Hat Linux Reporter: m_vogt
Component: egcsAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED WORKSFORME QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 5.2CC: gafton
Target Milestone: ---   
Target Release: ---   
Hardware: alpha   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-08-30 01:21:35 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 m_vogt 1999-01-13 10:36:17 UTC
The program segfaults if you link the pthread library as the
first library, because on intel it works in this order
I think it a bug in the egcs alpha.
It needs KDE but this is not a bug in KDE, because it works
on my Intel.

/*

  This program runs in both versions on my Intel RedHat 5.2
but on
  the alpha it gives a segfault if the pthread library is
  linked at first.

  I think this is a bug.

  Intel works:  RH5.2

  Alpha Debian segfault.
  * egcs-2.90.29 980515 (egcs-1.0.3 release)
  * RedHat 52 segfaults

*/

// KDE include files
#include <kapp.h>
#include <pthread.h>


/*



 Success :

g++ -I/opt/kde/include -I/opt/qt/include
-I/usr/X11R6/include -L/opt/kde/lib
-L/opt/qt/lib -L/usr/X11R6/lib test.cpp  -lkfile -lkfm
-lkdeui -lkdecore -lqt
-lXext -lX11 -lpthread


 SEGFAULT :

g++ -I/opt/kde/include -I/opt/qt/include
-I/usr/X11R6/include -L/opt/kde/lib
-L/opt/qt/lib -L/usr/X11R6/lib test.cpp  -lpthread -lkfile
-lkfm -lkdeui
 -lkdecore -lqt  -lXext -lX11


The only difference is the linking order of the pthread
library.


*/


static void *writerThread(void *arg){
   printf("a\n");
   return NULL;
}

int main(int nargs,char** args) {
   printf("hi\n");
   KApplication a( nargs, args, "kmpg" );
   pthread_t tr;
   printf("hello\n");
   pthread_create(&tr,NULL,writerThread,NULL);
   printf("b\n");
   a.exec();
   return 0;
 }

Comment 1 Cristian Gafton 1999-06-17 16:37:59 UTC
Are the other kde libraries linked in the example thread safe?
Is this still valid on the RH 6.0?

assigned to pbrown for follow ups.

Comment 2 Preston Brown 1999-07-06 14:10:59 UTC
This still happens under RHL 6.0 on alpha.  Cristian, even if the kde
libraries aren't thread safe, all the KDE/X stuff is being done in one
thread, so it shouldn't segfault, right?  I am no linking expert, but
this behaviour does seem strange to me too.

Comment 3 Preston Brown 1999-08-16 18:47:59 UTC
Jim, can you please take a look into this?

Comment 4 Jim Kingdon 1999-08-30 01:21:59 UTC
What libraries do I need to use to reproduce this bug?  I tried
it on a few systems here and I just got things like:
/usr/include/kconfigbase.h:80: qcolor.h: No such file or directory
It looks like it may be a real bug (link order does matter,
but getting it wrong should not - usually - cause core dumps).
Preston, is there a machine at redhat (say a chroot
jails on porky/jetson?) which can reproduce this?