On Thu, May 15, 2014 at 08:01:13AM +0200, Siegmar Gross wrote: > I'm using gcc-4.9.0 and have a problem with the following program. > I have reported the problem allready on gcc-help some days ago, > but didn't get any replies. Perhaps somebody in this list knows, > if the behaviour is intended.
Yes, this is what OpenMP standard requires. > #include <stdio.h> > #include <stdlib.h> > #include <omp.h> > > int main (void) > { > #pragma omp parallel default (none) > fprintf (stderr, "Hello!\n"); > return EXIT_SUCCESS; > } > > > I can solve the problem if I add "shared(__iob)" to "#pragma", > but then the program isn't portable any longer. Or don't use default (none), or don't use stderr directly in the default(none) parallel region (use a temporary variable, call a function that implicitly uses stderr, etc.). > In my opinion the compiler knows that I use OpenMP and that > I use "default(none)" so that it can automatically add all > necessary internal variables to the "shared clause" or that Please define what is internal variable. __iob is for the compiler not an internal variable of any kind, stderr is a macro like any other. Note that e.g. on Linux stderr is a macro and a variable (#define stderr stderr), treating in that case stderr as an internal variable would be really weird. Jakub