incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-467) [Intel Thread Checker 3.1] bogus data race after pthread_once()
Date Tue, 03 Jul 2007 21:39:04 GMT
[Intel Thread Checker 3.1] bogus data race after pthread_once()
---------------------------------------------------------------

                 Key: STDCXX-467
                 URL: https://issues.apache.org/jira/browse/STDCXX-467
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: Intel Thread Checker 3.1 with Intel C++ 9.1.049 on Red Hat Enterprise
Linux AS release 4 (Nahant Update 4)
            Reporter: Martin Sebor


Running the program below through the thread checker gives the Wrtite->Read data race error
shown in the output:

$ cat t.c && icc -V t.c -pthread && tcheck_cl -v a.out 
#include <pthread.h>

static int flag;
static void init () { flag = 1; }

static pthread_once_t flag_init;
static int foo () {
    pthread_once (&flag_init, init);
    return flag;
}

static void* thr_func (void *a) {
    int i;
    int n = 0;
    for (i = 0; i != 100; ++i)
        n += foo ();

    return (void*)n;
}

int main () {
    pthread_t pid [2];
    int i;

    for (i = 0; i != sizeof pid / sizeof *pid; ++i)
        pthread_create (pid + i, 0, thr_func, 0);

    for (i = 0; i != sizeof pid / sizeof *pid; ++i)
        pthread_join (pid [i], 0);
}
Intel(R) C Compiler for Intel(R) EM64T-based applications, Version 9.1    Build 20070320 Package
ID: l_cc_c_9.1.049
Copyright (C) 1985-2007 Intel Corporation.  All rights reserved.

Edison Design Group C/C++ Front End, version 3.6 (Mar 22 2007 02:18:08)
Copyright 1988-2005 Edison Design Group, Inc.

GNU ld version 2.15.92.0.2 20040927
Intel(R) Thread Checker 3.1 command line instrumentation driver (24400)
Copyright (c) 2007 Intel Corporation. All rights reserved.
Building project
Instrumenting
 14% a.out           ( All Functions ):..

Running:  /build/sebor/stdcxx-icc-9.1_049-15S/tests/a.out 


Application finished

_______________________________________________________________________________
|ID|Short Des|Sever|Co|Contex|Description                      |1st Ac|2nd Acc|
|  |cription |ity  |un|t[Best|                                 |cess[B|ess[Bes|
|  |         |Name |t |]     |                                 |est]  |t]     |
_______________________________________________________________________________
|1 |Write -> |Error|10|[a.out|Memory read at [a.out, 0x7b9]    |[a.out|[a.out,|
|  |Read     |     |0 |,     |conflicts with a prior memory    |,     |0x7b9] |
|  |data-race|     |  |0x79a]|write at [a.out, 0x7d0] (flow    |0x7d0]|       |
|  |         |     |  |      |dependence)                      |      |       |
_______________________________________________________________________________
|2 |Thread te|Infor|1 |WholeP|Thread termination at [a.out,    |[a.out|[a.out,|
|  |rmination|matio|  |rogram|0x762] - includes stack          |,     |0x762] |
|  |         |n    |  |1     |allocation of 10.004 MB and use  |0x762]|       |
|  |         |     |  |      |of 5.047 KB                      |      |       |
_______________________________________________________________________________
|3 |Thread te|Infor|1 |WholeP|Thread termination at [a.out,    |[a.out|[a.out,|
|  |rmination|matio|  |rogram|0x762] - includes stack          |,     |0x762] |
|  |         |n    |  |2     |allocation of 10.004 MB and use  |0x762]|       |
|  |         |     |  |      |of 4.984 KB                      |      |       |
_______________________________________________________________________________
|4 |Thread te|Infor|1 |WholeP|Thread termination at [a.out,    |[a.out|[a.out,|
|  |rmination|matio|  |rogram|0x728] - includes stack          |,     |0x728] |
|  |         |n    |  |3     |allocation of 10 MB and use of   |0x728]|       |
|  |         |     |  |      |1.984 KB                         |      |       |
_______________________________________________________________________________



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message