Skip to content

Commit

Permalink
Automatically SAVE module variable marked as THREADPRIVATE
Browse files Browse the repository at this point in the history
Without this change compiler segfaults on COPYIN of module variables.

Signed-off-by: Paul Osmialowski <[email protected]>
  • Loading branch information
pawosm-arm committed Aug 31, 2018
1 parent 6cbbbf9 commit 4e828b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/mp_correct/copyin.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
! RUN: %flang %s -fopenmp -fsyntax-only

module somemod
integer, allocatable :: something(:)
!$OMP THREADPRIVATE(something)
end module somemod

program some
use somemod

!$OMP PARALLEL COPYIN(something)
!$OMP END PARALLEL
end program some
2 changes: 2 additions & 0 deletions tools/flang1/flang1exe/semant.c
Original file line number Diff line number Diff line change
Expand Up @@ -3752,6 +3752,8 @@ semant1(int rednum, SST *top)
if (sptr == 0)
continue;
THREADP(sptr, 1);
if (sem.mod_sym)
SAVEP(sptr, 1);

if (STYPEG(sptr) != ST_CMBLK && !DCLDG(sptr) && !SAVEG(sptr) &&
!sem.savall) {
Expand Down

0 comments on commit 4e828b9

Please sign in to comment.