Hi folks,
The git testsuite is currently failing. I started to investigate and I
created this simplification program.

===
#include <stdio.h>
#include <pthread.h>

void *func(void * a)  {
        // printf("start\n");
        // fflush(stdout);
        for (int i = 0; i < 9; i++) {
                printf("out: %i\n", i);
                //printf("out\n");
                fflush(stdout);
        }
}



int main() {

        pthread_t a[9];

        for (int i = 0; i < 9; i++) {
                pthread_create(&a[i], NULL, func, NULL);
        }

        for (int i = 0; i < 9; i++) {
                pthread_join(a[i], NULL);
        }

        return 0;
}
===

Basically this program should output 81 lines (9 threads printing 9 lines),
but it actually print less. (I usually do `./a.out | wc -l`)

But, if you replace the print by a print with no argos (the commented one),
the program behave correctly.

And if instead you uncomment the print("start\") + fflush, it also behave
correctly (print 90 lines, 81 from the loop + 9 start).

My problem, is that I’m not able to investigate (I don’t know enoguh the
Glibc structure) and GDB seems to have a bug (break `func` + run end up
with SIGILL).

Etienne

Reply via email to