Subject: pthread assertion failure
To: None <>
From: Min Sik Kim <>
List: current-users
Date: 01/07/2004 23:42:32

I encountered an assertion failure while I was packaging
gnome-terminal-2.4.2.  gnome-terminal tests all possible charsets
using iconv to figure out which ones are available.  After trying
about 30 charsets, iconv_close() dumps core due to assertion failure
in pthread codes.

A *streamlined* version of gnome-terminal is at the end of this
message.  It iterates over 32 charsets, calling iconv_open() and
iconv_close() for each.


... (OK for 27 charsets)

DEBUG: testing charset GB18030.
DEBUG: Available
assertion "next != 0" failed: file "/usr/src/lib/libpthread/pthread_run.c", line 123, function "pthread__next"
Abort (core dumped)

I compiled this with the following command.

  cc -pthread -o terminal terminal.c

Without '-pthread', it runs well.  The assertion failure happens only
when '-pthread' is given.  I'm running one-month old -current (1.6ZG)
on i386.

Any advice?

 Min Sik Kim


#include <stdio.h>
#include <iconv.h>

const int N_CHARSETS = 32;

static char *charsets[] = {

int main()
  int i;
  iconv_t cd;

  for (i = 0; i < N_CHARSETS; i++) {
    cd = iconv_open (charsets[i], charsets[i]);
    fprintf(stderr, "DEBUG: testing charset %s.\n", charsets[i]);
    if (cd != (iconv_t)-1) {
      fprintf(stderr, "DEBUG: Available\n");
    } else {
      fprintf(stderr, "DEBUG: Not available.\n");
    fprintf(stderr, "DEBUG: Done.\n\n");
  return 0;