The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help: https://stackoverflow.com/questions/tagged/openmp
#pragma omp parallel default(none)
extern int s;
#pragma omp atomic
2.9 just says that automatic vars declared in scope inside of the construct are predetermined private and static vars declared in scope inside of the construct are predetermined shared, but local extern is IMHO neither of those.
If you look at the C99 standard, section 6.2.4 Storage durations of objects, states:
In the C++ standard, section 3.7.1 Static storage duration, states:An object whose identifier is declared with external or internal linkage, or with the storage-class specifier static has static storage duration. Its lifetime is the entire execution of the program and its stored value is initialized only once, prior to program
and section 3.7.2 Automatic storage duration, states:All objects which neither have dynamic storage duration nor are local have static storage duration.
So the base languages (C/C++) consider externs to have static storage duration.Local objects explicitly declared auto or register or not explicitly declared static or extern have automatic storage duration.
In the OpenMP V3.1 specification, section 18.104.22.168 Data-sharing Attribute Rules for Variables Referenced in a Construct (p83, line 30), states:
After you posted your comment, someone in the committee reviewed it and agreed with your comment. The current proposal is to change page 83 line 30 to say:• Static variables that are declared in a scope inside the construct are shared.
We believe this should take care of your concern. It not, please let us know.• Static storage duration variables that are declared in a scope inside the construct are shared.