Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build with gcc 9 #114

Closed
opoplawski opened this issue Feb 3, 2019 · 4 comments
Closed

Fails to build with gcc 9 #114

opoplawski opened this issue Feb 3, 2019 · 4 comments

Comments

@opoplawski
Copy link
Contributor

BUILDSTDERR: nco_omp.c: In function 'nco_openmp_ini':
BUILDSTDERR: nco_omp.c:210:38: error: 'fp_stderr' not specified in enclosing 'parallel'
BUILDSTDERR:   210 |  if(nco_dbg_lvl_get() >= nco_dbg_fl) (void)fprintf(fp_stderr,"%s: INFO Small parallel test region spawned team of %d thread(s)\n",nco_prg_nm_get(),thr_nbr_act);
BUILDSTDERR:       |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: nco_omp.c:205:10: error: enclosing 'parallel'
BUILDSTDERR:   205 | # pragma omp parallel default(none) shared(thr_nbr_act)
BUILDSTDERR:       |          ^~~
@czender
Copy link
Member

czender commented Feb 3, 2019

Thanks for reporting this. It may take some iteration to figure out what's going on. GCC9 appears to have altered its treatment of variables in OpenMP shared() pragmas. GCC8 complains when I explicitly share fp_stderr in order to solve the GCC9 problem above:

nco_omp.c: In function 'nco_openmp_ini':
nco_omp.c:205:43: error: 'fp_stderr' is predetermined 'shared' for 'shared'
 # pragma omp parallel default(none) shared(fp_stderr,thr_nbr_act)

I fear this means I need to implement GCC version-dependent shared() clauses. The other option is to remove the default(none) clause and hope that satisfies GCC9 and that nothing else breaks. I am committing that change to see whether GCC9 likes it. Does anyone have a brighter idea?

@opoplawski
Copy link
Contributor Author

Well, it does seem to be default(none) that triggers it. I'm not sure what the implication of removing it is. From https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00628.html:

- change data sharing for readonly variables without mutable members, they are
  no longer predetermined shared (this actually changed in earlier OpenMP standard
  releases, but was considered a mistake; for 5.0 it was decided it isn't going to
  be reverted; this makes a difference mainly when using default(none))

PS - What's the point of fp_stderr?

@czender
Copy link
Member

czender commented Feb 7, 2019

I used default(none) to be sure that every variable was explicitly labeled as shared or private. I think the default is shared. Some compilers complained that when stderr was labelled, so I created fp_stderr as an alias to it. Does it compile with GCC9 now? I'd be surprised if that was the only location that default(none) had to be removed.

@opoplawski
Copy link
Contributor Author

You're right about there being lots of default(none)s that need to be removed.

czender added a commit that referenced this issue Feb 13, 2019
Remove default(none) clauses to prevent GCC9 errors, fixes #114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants