Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 816 - egcs pthread bug
Summary: egcs pthread bug
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: egcs
Version: 5.2
Hardware: alpha
OS: Linux
medium
high
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-01-13 10:36 UTC by m_vogt
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-08-30 01:21:35 UTC


Attachments (Terms of Use)

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?


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