http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59983

            Bug ID: 59983
           Summary: By using -fopenmp local-variable contains wrong value
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktietz at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org

Following sample shows that amount of lions is calculate wrong by using
-fopenmp.

#include "stdio.h"
#include <omp.h>
#include <pthread.h>

void *do_thread(void *pa)
{
    int niterations = 4;
    int i = 0;
    pthread_self();

    #pragma omp parallel for
    for (i = 0; i < niterations; i++)
    {
        printf ("%s %d\n","ducks",i);
        fflush(0);
    }

    printf ("%s %d\n","lions",i);
    fflush(0);
    return NULL;
}

Reply via email to