diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-12-13 12:54:57 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-12-16 21:39:58 +0100 |
commit | 00c6e637482ec236c588698a9502c0c12cc2d704 (patch) | |
tree | 1932623109b43bc8ef961459f94d95da8893b8e6 | |
parent | b128055dc797e8cb9abe92284892a0d528c7151b (diff) | |
download | gcc-00c6e637482ec236c588698a9502c0c12cc2d704.zip gcc-00c6e637482ec236c588698a9502c0c12cc2d704.tar.gz gcc-00c6e637482ec236c588698a9502c0c12cc2d704.tar.bz2 |
Show coarrays on parse tree dump, implement debug for array references.
gcc/fortran/ChangeLog:
* dump-parse-tree.c (show_array_ref): Also show coarrays.
(debug): Implement for array reference.
(cherry picked from commit 501f470267445e037614649639d17a1b32b4a9aa)
-rw-r--r-- | gcc/fortran/dump-parse-tree.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index 591df8c..d1a3325 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -361,6 +361,31 @@ show_array_ref (gfc_array_ref * ar) } fputc (')', dumpfile); + if (ar->codimen == 0) + return; + + /* Show coarray part of the reference, if any. */ + fputc ('[',dumpfile); + for (i = ar->dimen; i < ar->dimen + ar->codimen; i++) + { + if (ar->dimen_type[i] == DIMEN_STAR) + fputc('*',dumpfile); + else if (ar->dimen_type[i] == DIMEN_THIS_IMAGE) + fputs("THIS_IMAGE", dumpfile); + else + { + show_expr (ar->start[i]); + if (ar->end[i]) + { + fputc(':', dumpfile); + show_expr (ar->end[i]); + } + } + if (i != ar->dimen + ar->codimen - 1) + fputs (" , ", dumpfile); + + } + fputc (']',dumpfile); } @@ -3588,3 +3613,14 @@ gfc_dump_global_symbols (FILE *f) else gfc_traverse_gsymbol (gfc_gsym_root, show_global_symbol, (void *) f); } + +/* Show an array ref. */ + +void debug (gfc_array_ref *ar) +{ + FILE *tmp = dumpfile; + dumpfile = stderr; + show_array_ref (ar); + fputc ('\n', dumpfile); + dumpfile = tmp; +} |