Tcl Source Code

View Ticket
Login
Ticket UUID: 219085
Title: tclUnixThrd.c won't compile under AIX 4.3.3 with -DTCL_THREA
Type: Bug Created on: 2000-10-26 01:10:27
Submitter: nobody Assigned to: nobody
Subsystem: 49. Threading Severity:
Priority: 2 Last modified: 2000-10-26 08:34:55
Status: Deleted Closed by: welch
Resolution: Fixed Closed on: 2000-10-26 01:34:55
Version: obsolete: 8.3
Description:
OriginalBugID: 5254 Bug
Version: 8.3
SubmitDate: '2000-04-25'
LastModified: '2000-04-25'
Severity: MED
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: AIX
OSVersion: AIX 4.3.3
FixedDate: '2000-04-25'
FixedInVersion: 8.3.1
ClosedDate: '2000-10-25'


Name:
Valdis Kletnieks

CVS:
SCCS:  @(#) tclUnixThrd.c 1.18 98/02/19 14:24:12

Comments:
The provided patch is *KNOWN SUBOPTIMAL*.  It got me a working compile,
    but should almost certainly be handled in another way.  A quick check of
    Solaris 2.6 and 2.7 show two different definitions of
    PTHREAD_MUTEX_INITIALIZER, but they both have the {} as well, and thus
    probably
    would encounter a problem.

ReproducibleScript:
The AIX 4.3.3 /usr/include/pthread.h file defines PTHREAD_MUTEX_INITIALIZER with a pair of {} already attached (which is needed to delimite the substructure in the PTHREAD_RWLOCK_INITIALIZER define further down).  When tclUnixThrd.c uses it with its own {},
the IBM xlc compiler complains about the number of initializers (which is correct - {1,2,3} is different from {{1,2,3}}.

ObservedBehavior:
Failure to compile cleanly

DesiredBehavior:
A correct compile

Patch:
*** unix/tclUnixThrd.c.dist     Wed Apr 12 16:47:56 2000
--- unix/tclUnixThrd.c  Fri Apr 21 14:30:42 2000
***************
*** 26,32 ****
--- 26,36 ----
   * initialize the mutex.
   */

+ #ifdef _AIX
+ static pthread_mutex_t masterLock = PTHREAD_MUTEX_INITIALIZER;
+ #else
  static pthread_mutex_t masterLock = {PTHREAD_MUTEX_INITIALIZER};
+ #endif

  /*
   * initLock is used to serialize initialization and finalization
***************
*** 33,39 ****
--- 37,47 ----
   * of Tcl.  It cannot use any dyamically allocated storage.
   */

+ #ifdef _AIX
+ static pthread_mutex_t initLock = PTHREAD_MUTEX_INITIALIZER;
+ #else
  static pthread_mutex_t initLock = {PTHREAD_MUTEX_INITIALIZER};
+ #endif

  /*
   * allocLock is used by Tcl's version of malloc for synchronization.
***************
*** 40,46 ****
--- 48,58 ----
   * For obvious reasons, cannot use any dyamically allocated storage.
   */

+ #ifdef _AIX
+ static pthread_mutex_t allocLock = PTHREAD_MUTEX_INITIALIZER;
+ #else
  static pthread_mutex_t allocLock = {PTHREAD_MUTEX_INITIALIZER};
+ #endif
  static pthread_mutex_t *allocLockPtr = &allocLock;

  /*

PatchFiles:
tclUnixThrd.c



Fixed in 8.3.1.  Those braces weren't correct for Solaris (x86
and Sparc) or Linux either. 
-- 04/25/2000 hobbs