Skip to content

Commit 5a5332d

Browse files
committed
Add lexical scopes for do concurrent loops
A problem occurs in code that compiles a do concurrent loop as a parallel OpenMP loop with a collapse clause, like this: !$omp do collapse(2) do concurrent (i=1:m, j=1:n) a(i,j) = 1 enddo With the collapse clause, parallel code generation for this loop (nest) is missing the upper scope label. This would likely cause problems for as yet unimplemented parallel code generation. Without parallelization but with -g the missing label causes an internal compiler error when DWARF generation assumes that the scope labels are present and valid. The fix for this problem is to propagate scoping information in routine collapse_add. (semutil.c) Std dumps are also updated to include lexical block syms. (dump.c)
1 parent cc9495e commit 5a5332d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tools/flang1/flang1exe/dump.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,8 @@ dstd(int stdx)
22562256
putint("ast", astx);
22572257
putnzint("lineno", STD_LINENO(stdx));
22582258
putnsym("label", STD_LABEL(stdx));
2259+
if (STD_BLKSYM(stdx) != SPTR_NULL)
2260+
putnsym("blksym", STD_BLKSYM(stdx));
22592261
putint("prev", STD_PREV(stdx));
22602262
putint("next", STD_NEXT(stdx));
22612263
#ifdef STD_TAG

tools/flang1/flang1exe/semutil.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5585,7 +5585,7 @@ collapse_add(DOINFO *doinfo)
55855585
{
55865586
int dtype;
55875587
SST tsst;
5588-
int ast, dest_ast;
5588+
int ast, dest_ast, std;
55895589
int count_var;
55905590

55915591
dtype = DTYPEG(doinfo->index_var);
@@ -5668,8 +5668,10 @@ collapse_add(DOINFO *doinfo)
56685668
ast = do_simdbegin(dinf);
56695669
else
56705670
ast = do_parbegin(dinf);
5671-
(void)add_stmt(ast);
5671+
std = add_stmt(ast);
56725672
sem.doif_depth = sv;
5673+
if (DI_ID(sv) == DI_DOCONCURRENT)
5674+
STD_BLKSYM(std) = DI_CONC_BLOCK_SYM(sv);
56735675
/*
56745676
* Compute the values for index variables in the collapsed do loops in
56755677
* the order from inner to outer.

0 commit comments

Comments
 (0)