From: Thomas Koenig Date: Sun, 13 Dec 2020 11:54:57 +0000 (+0100) Subject: Show coarrays on parse tree dump, implement debug for array references. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=501f470267445e037614649639d17a1b32b4a9aa;p=gcc.git 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. --- diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index b3fa1785b14..440627a4075 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); } @@ -3635,3 +3660,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; +}