This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 816 - egcs pthread bug
egcs pthread bug
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: egcs (Show other bugs)
5.2
alpha Linux
medium Severity high
: ---
: ---
Assigned To: Nalin Dahyabhai
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-01-13 05:36 EST by m_vogt
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-08-29 21:21:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description m_vogt 1999-01-13 05:36:17 EST
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 12:37:59 EDT
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 10:10:59 EDT
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 14:47:59 EDT
Jim, can you please take a look into this?
Comment 4 Jim Kingdon 1999-08-29 21:21:59 EDT
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?

Note You need to log in before you can comment on or make changes to this bug.