STM: Thread Local Storage [updated with example]

STM: Thread Local Storage [updated with example]

Hi -

Has anyone noticed any abnormal behavior when using thread local storage (TLS) in the presence of atomic blocks? Is there any complication with the fact that the STM library uses TLS itself? A seg fault manifests when all the following three happen:
1. you make a call to a function foo inside a transaction.
2. function foo accesses thread local storage
3. the thread local storage object is defined in another object file that is linked against the file that has function foo.

Consider the following very simple scenario:

////// file1.c
extern __thread int tls; /* Thread Local Storage */

__attribute__ ((tm_callable))
void foo() {
tls = 1;
}

main() {
__tm_atomic {
foo();
}
}

/////// file2.c
__thread int tls;

Linking these two files and trying to execute, the resulting executable seg faults
% icc -g -Qtm_enabled file1.c file2.c -o test
% test
Segmentation fault

-Haris

4 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

What I noticed is that the segmentation fault goes away when I compile without the -g flag (no debugging support).

Haris,

Thanks for the bug report. The bug will be fixed in the next What-If release...

hvolos:Hi -

Has anyone noticed any abnormal behavior when using thread local storage (TLS) in the presence of atomic blocks?

I've noticed same problems.
Thanks for your fast report.
___________
Texas Holdem

Accedere per lasciare un commento.