[Omp] atomic directive semantics

Richard Henderson rth at twiddle.net
Thu Sep 22 14:36:08 PDT 2005


The section describing the atomic directive says "expression with
scalar type", without defining scalar type.

>From C99 6.2.5 paragraphs 21, 18 and 11 we get

  (21) scalar types are arithmetic and pointer types
  (18) arithmetic types are integer and floating types
  (11) real floating and complex types are floating types

Which implies that complex types are scalars.  I'd have preferred
that the C standard used "non-aggregate" instead, but there we are.

So the question is, does OpenMP think that atomic operations are
supposed to be supported for complex numbers, or does it in fact
use the more usual definition of the term "scalar" and mean 
integral, pointer, and (non-complex) floating types?

For the most part, only 64-bit systems would be able to even implement
atomic operations on complex types, and even then only on complex float.

Along the same lines, how do compilers handle "long double"?  As far
as I know, x86_64 is the only system with a compare-and-swap instruction
wide enough to implement this.  Do compilers just print an error message
and leave it at that?


r~




More information about the Omp mailing list