LCOV - code coverage report
Current view: top level - gcc/fortran - dump-parse-tree.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 19.8 % 3112 615
Test Date: 2026-06-20 15:32:29 Functions: 31.7 % 63 20
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Parse tree dumper
       2              :    Copyright (C) 2003-2026 Free Software Foundation, Inc.
       3              :    Contributed by Steven Bosscher
       4              : 
       5              : This file is part of GCC.
       6              : 
       7              : GCC is free software; you can redistribute it and/or modify it under
       8              : the terms of the GNU General Public License as published by the Free
       9              : Software Foundation; either version 3, or (at your option) any later
      10              : version.
      11              : 
      12              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      13              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      14              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      15              : for more details.
      16              : 
      17              : You should have received a copy of the GNU General Public License
      18              : along with GCC; see the file COPYING3.  If not see
      19              : <http://www.gnu.org/licenses/>.  */
      20              : 
      21              : 
      22              : /* Actually this is just a collection of routines that used to be
      23              :    scattered around the sources.  Now that they are all in a single
      24              :    file, almost all of them can be static, and the other files don't
      25              :    have this mess in them.
      26              : 
      27              :    As a nice side-effect, this file can act as documentation of the
      28              :    gfc_code and gfc_expr structures and all their friends and
      29              :    relatives.
      30              : 
      31              :    TODO: Dump DATA.  */
      32              : 
      33              : #include "config.h"
      34              : #include "system.h"
      35              : #include "coretypes.h"
      36              : #include "gfortran.h"
      37              : #include "constructor.h"
      38              : #include "version.h"
      39              : #include "parse.h"  /* For gfc_ascii_statement.  */
      40              : #include "omp-api.h"  /* For omp_get_name_from_fr_id.  */
      41              : #include "gomp-constants.h"  /* For GOMP_INTEROP_IFR_SEPARATOR.  */
      42              : 
      43              : /* Keep track of indentation for symbol tree dumps.  */
      44              : static int show_level = 0;
      45              : 
      46              : /* The file handle we're dumping to is kept in a static variable.  This
      47              :    is not too cool, but it avoids a lot of passing it around.  */
      48              : static FILE *dumpfile;
      49              : 
      50              : /* Forward declaration of some of the functions.  */
      51              : static void show_expr (gfc_expr *p);
      52              : static void show_code_node (int, gfc_code *);
      53              : static void show_namespace (gfc_namespace *ns);
      54              : static void show_code (int, gfc_code *);
      55              : static void show_symbol (gfc_symbol *);
      56              : static void show_typespec (gfc_typespec *);
      57              : static void show_ref (gfc_ref *);
      58              : static void show_attr (symbol_attribute *, const char *);
      59              : 
      60              : DEBUG_FUNCTION void
      61            0 : debug (symbol_attribute *attr)
      62              : {
      63            0 :   FILE *tmp = dumpfile;
      64            0 :   dumpfile = stderr;
      65            0 :   show_attr (attr, NULL);
      66            0 :   fputc ('\n', dumpfile);
      67            0 :   dumpfile = tmp;
      68            0 : }
      69              : 
      70              : DEBUG_FUNCTION void
      71            0 : debug (gfc_formal_arglist *formal)
      72              : {
      73            0 :   FILE *tmp = dumpfile;
      74            0 :   dumpfile = stderr;
      75            0 :   for (; formal; formal = formal->next)
      76              :     {
      77            0 :       fputc ('\n', dumpfile);
      78            0 :       show_symbol (formal->sym);
      79              :     }
      80            0 :   fputc ('\n', dumpfile);
      81            0 :   dumpfile = tmp;
      82            0 : }
      83              : 
      84              : DEBUG_FUNCTION void
      85            0 : debug (symbol_attribute attr)
      86              : {
      87            0 :   debug (&attr);
      88            0 : }
      89              : 
      90              : DEBUG_FUNCTION void
      91            0 : debug (gfc_expr *e)
      92              : {
      93            0 :   FILE *tmp = dumpfile;
      94            0 :   dumpfile = stderr;
      95            0 :   if (e != NULL)
      96              :     {
      97            0 :       show_expr (e);
      98            0 :       fputc (' ', dumpfile);
      99            0 :       show_typespec (&e->ts);
     100              :     }
     101              :   else
     102            0 :     fputs ("() ", dumpfile);
     103              : 
     104            0 :   fputc ('\n', dumpfile);
     105            0 :   dumpfile = tmp;
     106            0 : }
     107              : 
     108              : DEBUG_FUNCTION void
     109            0 : debug (gfc_typespec *ts)
     110              : {
     111            0 :   FILE *tmp = dumpfile;
     112            0 :   dumpfile = stderr;
     113            0 :   show_typespec (ts);
     114            0 :   fputc ('\n', dumpfile);
     115            0 :   dumpfile = tmp;
     116            0 : }
     117              : 
     118              : DEBUG_FUNCTION void
     119            0 : debug (gfc_typespec ts)
     120              : {
     121            0 :   debug (&ts);
     122            0 : }
     123              : 
     124              : DEBUG_FUNCTION void
     125            0 : debug (gfc_ref *p)
     126              : {
     127            0 :   FILE *tmp = dumpfile;
     128            0 :   dumpfile = stderr;
     129            0 :   show_ref (p);
     130            0 :   fputc ('\n', dumpfile);
     131            0 :   dumpfile = tmp;
     132            0 : }
     133              : 
     134              : DEBUG_FUNCTION void
     135            0 : debug (gfc_namespace *ns)
     136              : {
     137            0 :   FILE *tmp = dumpfile;
     138            0 :   dumpfile = stderr;
     139            0 :   show_namespace (ns);
     140            0 :   fputc ('\n', dumpfile);
     141            0 :   dumpfile = tmp;
     142            0 : }
     143              : 
     144              : DEBUG_FUNCTION void
     145            0 : gfc_debug_expr (gfc_expr *e)
     146              : {
     147            0 :   FILE *tmp = dumpfile;
     148            0 :   dumpfile = stderr;
     149            0 :   show_expr (e);
     150            0 :   fputc ('\n', dumpfile);
     151            0 :   dumpfile = tmp;
     152            0 : }
     153              : 
     154              : /* Allow for dumping of a piece of code in the debugger.  */
     155              : 
     156              : DEBUG_FUNCTION void
     157            0 : gfc_debug_code (gfc_code *c)
     158              : {
     159            0 :   FILE *tmp = dumpfile;
     160            0 :   dumpfile = stderr;
     161            0 :   show_code (1, c);
     162            0 :   fputc ('\n', dumpfile);
     163            0 :   dumpfile = tmp;
     164            0 : }
     165              : 
     166              : DEBUG_FUNCTION void
     167            0 : gfc_debug_code_node (gfc_code *c)
     168              : {
     169            0 :   FILE *tmp = dumpfile;
     170            0 :   dumpfile = stderr;
     171            0 :   show_code_node (1, c);
     172            0 :   fputc ('\n', dumpfile);
     173            0 :   dumpfile = tmp;
     174            0 : }
     175              : 
     176              : DEBUG_FUNCTION void
     177            0 : debug (gfc_symbol *sym)
     178              : {
     179            0 :   FILE *tmp = dumpfile;
     180            0 :   dumpfile = stderr;
     181            0 :   show_symbol (sym);
     182            0 :   fputc ('\n', dumpfile);
     183            0 :   dumpfile = tmp;
     184            0 : }
     185              : 
     186              : /* Do indentation for a specific level.  */
     187              : 
     188              : static inline void
     189         1960 : code_indent (int level, gfc_st_label *label)
     190              : {
     191         1960 :   int i;
     192              : 
     193         1960 :   if (label != NULL)
     194            0 :     fprintf (dumpfile, "%-5d ", label->value);
     195              : 
     196        17704 :   for (i = 0; i < (2 * level - (label ? 6 : 0)); i++)
     197         6892 :     fputc (' ', dumpfile);
     198         1960 : }
     199              : 
     200              : 
     201              : /* Simple indentation at the current level.  This one
     202              :    is used to show symbols.  */
     203              : 
     204              : static inline void
     205         1912 : show_indent (void)
     206              : {
     207         1912 :   fputc ('\n', dumpfile);
     208         1912 :   code_indent (show_level, NULL);
     209         1912 : }
     210              : 
     211              : 
     212              : /* Show type-specific information.  */
     213              : 
     214              : static void
     215          566 : show_typespec (gfc_typespec *ts)
     216              : {
     217          566 :   if (ts->type == BT_ASSUMED)
     218              :     {
     219            0 :       fputs ("(TYPE(*))", dumpfile);
     220            0 :       return;
     221              :     }
     222              : 
     223          566 :   fprintf (dumpfile, "(%s ", gfc_basic_typename (ts->type));
     224              : 
     225          566 :   switch (ts->type)
     226              :     {
     227          150 :     case BT_DERIVED:
     228          150 :     case BT_CLASS:
     229          150 :     case BT_UNION:
     230          150 :       fprintf (dumpfile, "%s", ts->u.derived->name);
     231          150 :       break;
     232              : 
     233           18 :     case BT_CHARACTER:
     234           18 :       if (ts->u.cl)
     235           16 :         show_expr (ts->u.cl->length);
     236           18 :       fprintf(dumpfile, " %d", ts->kind);
     237           18 :       break;
     238              : 
     239          398 :     default:
     240          398 :       fprintf (dumpfile, "%d", ts->kind);
     241          398 :       break;
     242              :     }
     243          566 :   if (ts->is_c_interop)
     244          100 :     fputs (" C_INTEROP", dumpfile);
     245              : 
     246          566 :   if (ts->is_iso_c)
     247           92 :     fputs (" ISO_C", dumpfile);
     248              : 
     249          566 :   if (ts->deferred)
     250            0 :     fputs (" DEFERRED", dumpfile);
     251              : 
     252          566 :   fputc (')', dumpfile);
     253              : }
     254              : 
     255              : 
     256              : /* Show an actual argument list.  */
     257              : 
     258              : static void
     259           24 : show_actual_arglist (gfc_actual_arglist *a)
     260              : {
     261           24 :   fputc ('(', dumpfile);
     262              : 
     263           72 :   for (; a; a = a->next)
     264              :     {
     265           24 :       fputc ('(', dumpfile);
     266           24 :       if (a->name != NULL)
     267            0 :         fprintf (dumpfile, "%s = ", a->name);
     268           24 :       if (a->expr != NULL)
     269           24 :         show_expr (a->expr);
     270              :       else
     271            0 :         fputs ("(arg not-present)", dumpfile);
     272              : 
     273           24 :       fputc (')', dumpfile);
     274           24 :       if (a->next != NULL)
     275            0 :         fputc (' ', dumpfile);
     276              :     }
     277              : 
     278           24 :   fputc (')', dumpfile);
     279           24 : }
     280              : 
     281              : 
     282              : /* Show a gfc_array_spec array specification structure.  */
     283              : 
     284              : static void
     285          142 : show_array_spec (gfc_array_spec *as)
     286              : {
     287          142 :   const char *c;
     288          142 :   int i;
     289              : 
     290          142 :   if (as == NULL)
     291              :     {
     292          142 :       fputs ("()", dumpfile);
     293          142 :       return;
     294              :     }
     295              : 
     296            0 :   fprintf (dumpfile, "(%d [%d]", as->rank, as->corank);
     297              : 
     298            0 :   if (as->rank + as->corank > 0 || as->rank == -1)
     299              :     {
     300            0 :       switch (as->type)
     301              :       {
     302              :         case AS_EXPLICIT:      c = "AS_EXPLICIT";      break;
     303            0 :         case AS_DEFERRED:      c = "AS_DEFERRED";      break;
     304            0 :         case AS_ASSUMED_SIZE:  c = "AS_ASSUMED_SIZE";  break;
     305            0 :         case AS_ASSUMED_SHAPE: c = "AS_ASSUMED_SHAPE"; break;
     306            0 :         case AS_ASSUMED_RANK:  c = "AS_ASSUMED_RANK";  break;
     307            0 :         default:
     308            0 :           gfc_internal_error ("show_array_spec(): Unhandled array shape "
     309              :                               "type.");
     310              :       }
     311            0 :       fprintf (dumpfile, " %s ", c);
     312              : 
     313            0 :       for (i = 0; i < as->rank + as->corank; i++)
     314              :         {
     315            0 :           show_expr (as->lower[i]);
     316            0 :           fputc (' ', dumpfile);
     317            0 :           show_expr (as->upper[i]);
     318            0 :           fputc (' ', dumpfile);
     319              :         }
     320              :     }
     321              : 
     322            0 :   fputc (')', dumpfile);
     323              : }
     324              : 
     325              : 
     326              : /* Show a gfc_array_ref array reference structure.  */
     327              : 
     328              : static void
     329            0 : show_array_ref (gfc_array_ref * ar)
     330              : {
     331            0 :   int i;
     332              : 
     333            0 :   fputc ('(', dumpfile);
     334              : 
     335            0 :   switch (ar->type)
     336              :     {
     337            0 :     case AR_FULL:
     338            0 :       fputs ("FULL", dumpfile);
     339            0 :       break;
     340              : 
     341              :     case AR_SECTION:
     342            0 :       for (i = 0; i < ar->dimen; i++)
     343              :         {
     344              :           /* There are two types of array sections: either the
     345              :              elements are identified by an integer array ('vector'),
     346              :              or by an index range. In the former case we only have to
     347              :              print the start expression which contains the vector, in
     348              :              the latter case we have to print any of lower and upper
     349              :              bound and the stride, if they're present.  */
     350              : 
     351            0 :           if (ar->start[i] != NULL)
     352            0 :             show_expr (ar->start[i]);
     353              : 
     354            0 :           if (ar->dimen_type[i] == DIMEN_RANGE)
     355              :             {
     356            0 :               fputc (':', dumpfile);
     357              : 
     358            0 :               if (ar->end[i] != NULL)
     359            0 :                 show_expr (ar->end[i]);
     360              : 
     361            0 :               if (ar->stride[i] != NULL)
     362              :                 {
     363            0 :                   fputc (':', dumpfile);
     364            0 :                   show_expr (ar->stride[i]);
     365              :                 }
     366              :             }
     367              : 
     368            0 :           if (i != ar->dimen - 1)
     369            0 :             fputs (" , ", dumpfile);
     370              :         }
     371              :       break;
     372              : 
     373              :     case AR_ELEMENT:
     374            0 :       for (i = 0; i < ar->dimen; i++)
     375              :         {
     376            0 :           show_expr (ar->start[i]);
     377            0 :           if (i != ar->dimen - 1)
     378            0 :             fputs (" , ", dumpfile);
     379              :         }
     380              :       break;
     381              : 
     382            0 :     case AR_UNKNOWN:
     383            0 :       fputs ("UNKNOWN", dumpfile);
     384            0 :       break;
     385              : 
     386            0 :     default:
     387            0 :       gfc_internal_error ("show_array_ref(): Unknown array reference");
     388              :     }
     389              : 
     390            0 :   fputc (')', dumpfile);
     391            0 :   if (ar->codimen == 0)
     392              :     return;
     393              : 
     394              :   /* Show coarray part of the reference, if any.  */
     395            0 :   fputc ('[',dumpfile);
     396            0 :   for (i = ar->dimen; i < ar->dimen + ar->codimen; i++)
     397              :     {
     398            0 :       if (ar->dimen_type[i] == DIMEN_STAR)
     399            0 :         fputc('*',dumpfile);
     400            0 :       else if (ar->dimen_type[i] == DIMEN_THIS_IMAGE)
     401            0 :         fputs("THIS_IMAGE", dumpfile);
     402              :       else
     403              :         {
     404            0 :           show_expr (ar->start[i]);
     405            0 :           if (ar->end[i])
     406              :             {
     407            0 :               fputc(':', dumpfile);
     408            0 :               show_expr (ar->end[i]);
     409              :             }
     410              :         }
     411            0 :       if (i != ar->dimen + ar->codimen - 1)
     412            0 :         fputs (" , ", dumpfile);
     413              : 
     414              :     }
     415            0 :   fputc (']',dumpfile);
     416              : }
     417              : 
     418              : 
     419              : /* Show a list of gfc_ref structures.  */
     420              : 
     421              : static void
     422           84 : show_ref (gfc_ref *p)
     423              : {
     424          120 :   for (; p; p = p->next)
     425           36 :     switch (p->type)
     426              :       {
     427            0 :       case REF_ARRAY:
     428            0 :         show_array_ref (&p->u.ar);
     429            0 :         break;
     430              : 
     431           36 :       case REF_COMPONENT:
     432           36 :         fprintf (dumpfile, " %% %s", p->u.c.component->name);
     433           36 :         break;
     434              : 
     435            0 :       case REF_SUBSTRING:
     436            0 :         fputc ('(', dumpfile);
     437            0 :         show_expr (p->u.ss.start);
     438            0 :         fputc (':', dumpfile);
     439            0 :         show_expr (p->u.ss.end);
     440            0 :         fputc (')', dumpfile);
     441            0 :         break;
     442              : 
     443            0 :       case REF_INQUIRY:
     444            0 :         switch (p->u.i)
     445              :         {
     446            0 :           case INQUIRY_KIND:
     447            0 :             fprintf (dumpfile, " INQUIRY_KIND ");
     448            0 :             break;
     449            0 :           case INQUIRY_LEN:
     450            0 :             fprintf (dumpfile, " INQUIRY_LEN ");
     451            0 :             break;
     452            0 :           case INQUIRY_RE:
     453            0 :             fprintf (dumpfile, " INQUIRY_RE ");
     454            0 :             break;
     455            0 :           case INQUIRY_IM:
     456            0 :             fprintf (dumpfile, " INQUIRY_IM ");
     457              :         }
     458              :         break;
     459              : 
     460            0 :       default:
     461            0 :         gfc_internal_error ("show_ref(): Bad component code");
     462              :       }
     463           84 : }
     464              : 
     465              : 
     466              : /* Display a constructor.  Works recursively for array constructors.  */
     467              : 
     468              : static void
     469           40 : show_constructor (gfc_constructor_base base)
     470              : {
     471           40 :   gfc_constructor *c;
     472          170 :   for (c = gfc_constructor_first (base); c; c = gfc_constructor_next (c))
     473              :     {
     474          130 :       if (c->iterator == NULL)
     475          130 :         show_expr (c->expr);
     476              :       else
     477              :         {
     478            0 :           fputc ('(', dumpfile);
     479            0 :           show_expr (c->expr);
     480              : 
     481            0 :           fputc (' ', dumpfile);
     482            0 :           show_expr (c->iterator->var);
     483            0 :           fputc ('=', dumpfile);
     484            0 :           show_expr (c->iterator->start);
     485            0 :           fputc (',', dumpfile);
     486            0 :           show_expr (c->iterator->end);
     487            0 :           fputc (',', dumpfile);
     488            0 :           show_expr (c->iterator->step);
     489              : 
     490            0 :           fputc (')', dumpfile);
     491              :         }
     492              : 
     493          130 :       if (gfc_constructor_next (c) != NULL)
     494           90 :         fputs (" , ", dumpfile);
     495              :     }
     496           40 : }
     497              : 
     498              : 
     499              : static void
     500           16 : show_char_const (const gfc_char_t *c, gfc_charlen_t length)
     501              : {
     502           16 :   fputc ('\'', dumpfile);
     503           32 :   for (size_t i = 0; i < (size_t) length; i++)
     504              :     {
     505           16 :       if (c[i] == '\'')
     506            0 :         fputs ("''", dumpfile);
     507              :       else
     508           16 :         fputs (gfc_print_wide_char (c[i]), dumpfile);
     509              :     }
     510           16 :   fputc ('\'', dumpfile);
     511           16 : }
     512              : 
     513              : 
     514              : /* Show a component-call expression.  */
     515              : 
     516              : static void
     517            0 : show_compcall (gfc_expr* p)
     518              : {
     519            0 :   gcc_assert (p->expr_type == EXPR_COMPCALL);
     520              : 
     521            0 :   fprintf (dumpfile, "%s", p->symtree->n.sym->name);
     522            0 :   show_ref (p->ref);
     523            0 :   fprintf (dumpfile, "%s", p->value.compcall.name);
     524              : 
     525            0 :   show_actual_arglist (p->value.compcall.actual);
     526            0 : }
     527              : 
     528              : 
     529              : /* Show an expression.  */
     530              : 
     531              : static void
     532          518 : show_expr (gfc_expr *p)
     533              : {
     534          518 :   const char *c;
     535          518 :   int i;
     536              : 
     537          518 :   if (p == NULL)
     538              :     {
     539           42 :       fputs ("()", dumpfile);
     540           42 :       return;
     541              :     }
     542              : 
     543          476 :   switch (p->expr_type)
     544              :     {
     545            0 :     case EXPR_SUBSTRING:
     546            0 :       show_char_const (p->value.character.string, p->value.character.length);
     547            0 :       show_ref (p->ref);
     548            0 :       break;
     549              : 
     550           40 :     case EXPR_STRUCTURE:
     551           40 :       fprintf (dumpfile, "%s(", p->ts.u.derived->name);
     552           40 :       show_constructor (p->value.constructor);
     553           40 :       fputc (')', dumpfile);
     554           40 :       break;
     555              : 
     556            0 :     case EXPR_ARRAY:
     557            0 :       fputs ("(/ ", dumpfile);
     558            0 :       if (p->ts.type == BT_CHARACTER
     559            0 :           && p->ts.u.cl
     560            0 :           && p->ts.u.cl->length_from_typespec
     561            0 :           && p->ts.u.cl->length)
     562              :         {
     563            0 :           show_typespec (&p->ts);
     564            0 :           fputs (" :: ", dumpfile);
     565              :         }
     566            0 :       show_constructor (p->value.constructor);
     567            0 :       fputs (" /)", dumpfile);
     568              : 
     569            0 :       show_ref (p->ref);
     570            0 :       break;
     571              : 
     572           60 :     case EXPR_NULL:
     573           60 :       fputs ("NULL()", dumpfile);
     574           60 :       break;
     575              : 
     576          256 :     case EXPR_CONSTANT:
     577          256 :       switch (p->ts.type)
     578              :         {
     579          224 :         case BT_INTEGER:
     580          224 :           mpz_out_str (dumpfile, 10, p->value.integer);
     581              : 
     582          224 :           if (p->ts.kind != gfc_default_integer_kind)
     583           22 :             fprintf (dumpfile, "_%d", p->ts.kind);
     584              :           break;
     585              : 
     586            0 :         case BT_UNSIGNED:
     587            0 :           mpz_out_str (dumpfile, 10, p->value.integer);
     588            0 :           fputc('u', dumpfile);
     589              : 
     590            0 :           if (p->ts.kind != gfc_default_integer_kind)
     591            0 :             fprintf (dumpfile, "_%d", p->ts.kind);
     592              :           break;
     593              : 
     594            0 :         case BT_LOGICAL:
     595            0 :           if (p->value.logical)
     596            0 :             fputs (".true.", dumpfile);
     597              :           else
     598            0 :             fputs (".false.", dumpfile);
     599              :           break;
     600              : 
     601           16 :         case BT_REAL:
     602           16 :           mpfr_out_str (dumpfile, 10, 0, p->value.real, GFC_RND_MODE);
     603           16 :           if (p->ts.kind != gfc_default_real_kind)
     604           12 :             fprintf (dumpfile, "_%d", p->ts.kind);
     605              :           break;
     606              : 
     607           16 :         case BT_CHARACTER:
     608           16 :           show_char_const (p->value.character.string,
     609              :                            p->value.character.length);
     610           16 :           break;
     611              : 
     612            0 :         case BT_COMPLEX:
     613            0 :           fputs ("(complex ", dumpfile);
     614              : 
     615            0 :           mpfr_out_str (dumpfile, 10, 0, mpc_realref (p->value.complex),
     616              :                         GFC_RND_MODE);
     617            0 :           if (p->ts.kind != gfc_default_complex_kind)
     618            0 :             fprintf (dumpfile, "_%d", p->ts.kind);
     619              : 
     620            0 :           fputc (' ', dumpfile);
     621              : 
     622            0 :           mpfr_out_str (dumpfile, 10, 0, mpc_imagref (p->value.complex),
     623              :                         GFC_RND_MODE);
     624            0 :           if (p->ts.kind != gfc_default_complex_kind)
     625            0 :             fprintf (dumpfile, "_%d", p->ts.kind);
     626              : 
     627            0 :           fputc (')', dumpfile);
     628            0 :           break;
     629              : 
     630            0 :         case BT_BOZ:
     631            0 :           if (p->boz.rdx == 2)
     632            0 :             fputs ("b'", dumpfile);
     633            0 :           else if (p->boz.rdx == 8)
     634            0 :             fputs ("o'", dumpfile);
     635              :           else
     636            0 :             fputs ("z'", dumpfile);
     637            0 :           fprintf (dumpfile, "%s'", p->boz.str);
     638            0 :           break;
     639              : 
     640            0 :         case BT_HOLLERITH:
     641            0 :           fprintf (dumpfile, HOST_WIDE_INT_PRINT_DEC "H",
     642              :                    p->representation.length);
     643            0 :           c = p->representation.string;
     644            0 :           for (i = 0; i < p->representation.length; i++, c++)
     645              :             {
     646            0 :               fputc (*c, dumpfile);
     647              :             }
     648              :           break;
     649              : 
     650            0 :         default:
     651            0 :           fputs ("???", dumpfile);
     652            0 :           break;
     653              :         }
     654              : 
     655          256 :       if (p->representation.string)
     656              :         {
     657            0 :           fputs (" {", dumpfile);
     658            0 :           c = p->representation.string;
     659            0 :           for (i = 0; i < p->representation.length; i++, c++)
     660              :             {
     661            0 :               fprintf (dumpfile, "%.2x", (unsigned int) *c);
     662            0 :               if (i < p->representation.length - 1)
     663            0 :                 fputc (',', dumpfile);
     664              :             }
     665            0 :           fputc ('}', dumpfile);
     666              :         }
     667              : 
     668              :       break;
     669              : 
     670           84 :     case EXPR_VARIABLE:
     671           84 :       if (p->symtree->n.sym->ns && p->symtree->n.sym->ns->proc_name)
     672           84 :         fprintf (dumpfile, "%s:", p->symtree->n.sym->ns->proc_name->name);
     673           84 :       fprintf (dumpfile, "%s", p->symtree->n.sym->name);
     674           84 :       show_ref (p->ref);
     675           84 :       break;
     676              : 
     677           12 :     case EXPR_OP:
     678           12 :       fputc ('(', dumpfile);
     679           12 :       switch (p->value.op.op)
     680              :         {
     681            0 :         case INTRINSIC_UPLUS:
     682            0 :           fputs ("U+ ", dumpfile);
     683            0 :           break;
     684            0 :         case INTRINSIC_UMINUS:
     685            0 :           fputs ("U- ", dumpfile);
     686            0 :           break;
     687            0 :         case INTRINSIC_PLUS:
     688            0 :           fputs ("+ ", dumpfile);
     689            0 :           break;
     690            0 :         case INTRINSIC_MINUS:
     691            0 :           fputs ("- ", dumpfile);
     692            0 :           break;
     693            0 :         case INTRINSIC_TIMES:
     694            0 :           fputs ("* ", dumpfile);
     695            0 :           break;
     696            0 :         case INTRINSIC_DIVIDE:
     697            0 :           fputs ("/ ", dumpfile);
     698            0 :           break;
     699            0 :         case INTRINSIC_POWER:
     700            0 :           fputs ("** ", dumpfile);
     701            0 :           break;
     702            0 :         case INTRINSIC_CONCAT:
     703            0 :           fputs ("// ", dumpfile);
     704            0 :           break;
     705            0 :         case INTRINSIC_AND:
     706            0 :           fputs ("AND ", dumpfile);
     707            0 :           break;
     708            0 :         case INTRINSIC_OR:
     709            0 :           fputs ("OR ", dumpfile);
     710            0 :           break;
     711            0 :         case INTRINSIC_EQV:
     712            0 :           fputs ("EQV ", dumpfile);
     713            0 :           break;
     714            0 :         case INTRINSIC_NEQV:
     715            0 :           fputs ("NEQV ", dumpfile);
     716            0 :           break;
     717            0 :         case INTRINSIC_EQ:
     718            0 :         case INTRINSIC_EQ_OS:
     719            0 :           fputs ("== ", dumpfile);
     720            0 :           break;
     721           12 :         case INTRINSIC_NE:
     722           12 :         case INTRINSIC_NE_OS:
     723           12 :           fputs ("/= ", dumpfile);
     724           12 :           break;
     725            0 :         case INTRINSIC_GT:
     726            0 :         case INTRINSIC_GT_OS:
     727            0 :           fputs ("> ", dumpfile);
     728            0 :           break;
     729            0 :         case INTRINSIC_GE:
     730            0 :         case INTRINSIC_GE_OS:
     731            0 :           fputs (">= ", dumpfile);
     732            0 :           break;
     733            0 :         case INTRINSIC_LT:
     734            0 :         case INTRINSIC_LT_OS:
     735            0 :           fputs ("< ", dumpfile);
     736            0 :           break;
     737            0 :         case INTRINSIC_LE:
     738            0 :         case INTRINSIC_LE_OS:
     739            0 :           fputs ("<= ", dumpfile);
     740            0 :           break;
     741            0 :         case INTRINSIC_NOT:
     742            0 :           fputs ("NOT ", dumpfile);
     743            0 :           break;
     744            0 :         case INTRINSIC_PARENTHESES:
     745            0 :           fputs ("parens ", dumpfile);
     746            0 :           break;
     747              : 
     748            0 :         default:
     749            0 :           gfc_internal_error
     750            0 :             ("show_expr(): Bad intrinsic in expression");
     751              :         }
     752              : 
     753           12 :       show_expr (p->value.op.op1);
     754              : 
     755           12 :       if (p->value.op.op2)
     756              :         {
     757           12 :           fputc (' ', dumpfile);
     758           12 :           show_expr (p->value.op.op2);
     759              :         }
     760              : 
     761           12 :       fputc (')', dumpfile);
     762           12 :       break;
     763              : 
     764           24 :     case EXPR_FUNCTION:
     765           24 :       if (p->value.function.name == NULL)
     766              :         {
     767           24 :           fprintf (dumpfile, "%s", p->symtree->n.sym->name);
     768           24 :           if (gfc_is_proc_ptr_comp (p))
     769            0 :             show_ref (p->ref);
     770           24 :           fputc ('[', dumpfile);
     771           24 :           show_actual_arglist (p->value.function.actual);
     772           24 :           fputc (']', dumpfile);
     773              :         }
     774              :       else
     775              :         {
     776            0 :           fprintf (dumpfile, "%s", p->value.function.name);
     777            0 :           if (gfc_is_proc_ptr_comp (p))
     778            0 :             show_ref (p->ref);
     779            0 :           fputc ('[', dumpfile);
     780            0 :           fputc ('[', dumpfile);
     781            0 :           show_actual_arglist (p->value.function.actual);
     782            0 :           fputc (']', dumpfile);
     783            0 :           fputc (']', dumpfile);
     784              :         }
     785              : 
     786              :       break;
     787              : 
     788            0 :     case EXPR_CONDITIONAL:
     789            0 :       fputc ('(', dumpfile);
     790            0 :       show_expr (p->value.conditional.condition);
     791            0 :       fputs (" ? ", dumpfile);
     792            0 :       show_expr (p->value.conditional.true_expr);
     793            0 :       fputs (" : ", dumpfile);
     794            0 :       show_expr (p->value.conditional.false_expr);
     795            0 :       fputc (')', dumpfile);
     796            0 :       break;
     797              : 
     798            0 :     case EXPR_COMPCALL:
     799            0 :       show_compcall (p);
     800            0 :       break;
     801              : 
     802            0 :     default:
     803            0 :       gfc_internal_error ("show_expr(): Don't know how to show expr");
     804              :     }
     805              : }
     806              : 
     807              : /* Show symbol attributes.  The flavor and intent are followed by
     808              :    whatever single bit attributes are present.  */
     809              : 
     810              : static void
     811          336 : show_attr (symbol_attribute *attr, const char * module)
     812              : {
     813          336 :   fputc ('(', dumpfile);
     814          336 :   if (attr->flavor != FL_UNKNOWN)
     815              :     {
     816          336 :       if (attr->flavor == FL_DERIVED && attr->pdt_template)
     817            0 :         fputs ("PDT-TEMPLATE ", dumpfile);
     818              :       else
     819          336 :         fprintf (dumpfile, "%s ", gfc_code2string (flavors, attr->flavor));
     820              :     }
     821          336 :   if (attr->access != ACCESS_UNKNOWN)
     822           70 :     fprintf (dumpfile, "%s ", gfc_code2string (access_types, attr->access));
     823          336 :   if (attr->proc != PROC_UNKNOWN)
     824           38 :     fprintf (dumpfile, "%s ", gfc_code2string (procedures, attr->proc));
     825          336 :   if (attr->save != SAVE_NONE)
     826           18 :     fprintf (dumpfile, "%s", gfc_code2string (save_status, attr->save));
     827              : 
     828          336 :   if (attr->artificial)
     829           36 :     fputs (" ARTIFICIAL", dumpfile);
     830          336 :   if (attr->allocatable)
     831            0 :     fputs (" ALLOCATABLE", dumpfile);
     832          336 :   if (attr->asynchronous)
     833            0 :     fputs (" ASYNCHRONOUS", dumpfile);
     834          336 :   if (attr->codimension)
     835            0 :     fputs (" CODIMENSION", dumpfile);
     836          336 :   if (attr->dimension)
     837            0 :     fputs (" DIMENSION", dumpfile);
     838          336 :   if (attr->contiguous)
     839            0 :     fputs (" CONTIGUOUS", dumpfile);
     840          336 :   if (attr->external)
     841            0 :     fputs (" EXTERNAL", dumpfile);
     842          336 :   if (attr->intrinsic)
     843           24 :     fputs (" INTRINSIC", dumpfile);
     844          336 :   if (attr->optional)
     845            0 :     fputs (" OPTIONAL", dumpfile);
     846          336 :   if (attr->pdt_kind)
     847            0 :     fputs (" KIND", dumpfile);
     848          336 :   if (attr->pdt_len)
     849            0 :     fputs (" LEN", dumpfile);
     850          336 :   if (attr->pointer)
     851            0 :     fputs (" POINTER", dumpfile);
     852          336 :   if (attr->subref_array_pointer)
     853            0 :     fputs (" SUBREF-ARRAY-POINTER", dumpfile);
     854          336 :   if (attr->cray_pointer)
     855            0 :     fputs (" CRAY-POINTER", dumpfile);
     856          336 :   if (attr->cray_pointee)
     857            0 :     fputs (" CRAY-POINTEE", dumpfile);
     858          336 :   if (attr->is_protected)
     859            0 :     fputs (" PROTECTED", dumpfile);
     860          336 :   if (attr->value)
     861            0 :     fputs (" VALUE", dumpfile);
     862          336 :   if (attr->volatile_)
     863            0 :     fputs (" VOLATILE", dumpfile);
     864          336 :   if (attr->omp_groupprivate)
     865            0 :     fputs (" GROUPPRIVATE", dumpfile);
     866          336 :   if (attr->threadprivate)
     867            0 :     fputs (" THREADPRIVATE", dumpfile);
     868          336 :   if (attr->temporary)
     869            0 :     fputs (" TEMPORARY", dumpfile);
     870          336 :   if (attr->target)
     871           18 :     fputs (" TARGET", dumpfile);
     872          336 :   if (attr->dummy)
     873              :     {
     874           18 :       fputs (" DUMMY", dumpfile);
     875           18 :       if (attr->intent != INTENT_UNKNOWN)
     876           12 :         fprintf (dumpfile, "(%s)", gfc_intent_string (attr->intent));
     877              :     }
     878              : 
     879          336 :   if (attr->result)
     880            0 :     fputs (" RESULT", dumpfile);
     881          336 :   if (attr->entry)
     882            0 :     fputs (" ENTRY", dumpfile);
     883          336 :   if (attr->entry_master)
     884            0 :     fputs (" ENTRY-MASTER", dumpfile);
     885          336 :   if (attr->mixed_entry_master)
     886            0 :     fputs (" MIXED-ENTRY-MASTER", dumpfile);
     887          336 :   if (attr->is_bind_c)
     888            8 :     fputs (" BIND(C)", dumpfile);
     889              : 
     890          336 :   if (attr->data)
     891            0 :     fputs (" DATA", dumpfile);
     892          336 :   if (attr->use_assoc)
     893              :     {
     894          112 :       fputs (" USE-ASSOC", dumpfile);
     895          112 :       if (module != NULL)
     896          112 :         fprintf (dumpfile, "(%s)", module);
     897              :     }
     898              : 
     899          336 :   if (attr->in_namelist)
     900            0 :     fputs (" IN-NAMELIST", dumpfile);
     901          336 :   if (attr->in_common)
     902            0 :     fputs (" IN-COMMON", dumpfile);
     903          336 :   if (attr->in_equivalence)
     904            0 :     fputs (" IN-EQUIVALENCE", dumpfile);
     905              : 
     906          336 :   if (attr->abstract)
     907            0 :     fputs (" ABSTRACT", dumpfile);
     908          336 :   if (attr->function)
     909           52 :     fputs (" FUNCTION", dumpfile);
     910          336 :   if (attr->subroutine)
     911           58 :     fputs (" SUBROUTINE", dumpfile);
     912          336 :   if (attr->implicit_type)
     913           24 :     fputs (" IMPLICIT-TYPE", dumpfile);
     914              : 
     915          336 :   if (attr->sequence)
     916            0 :     fputs (" SEQUENCE", dumpfile);
     917          336 :   if (attr->alloc_comp)
     918            0 :     fputs (" ALLOC-COMP", dumpfile);
     919          336 :   if (attr->pointer_comp)
     920            0 :     fputs (" POINTER-COMP", dumpfile);
     921          336 :   if (attr->proc_pointer_comp)
     922            0 :     fputs (" PROC-POINTER-COMP", dumpfile);
     923          336 :   if (attr->private_comp)
     924            4 :     fputs (" PRIVATE-COMP", dumpfile);
     925          336 :   if (attr->zero_comp)
     926            6 :     fputs (" ZERO-COMP", dumpfile);
     927          336 :   if (attr->coarray_comp)
     928            0 :     fputs (" COARRAY-COMP", dumpfile);
     929          336 :   if (attr->lock_comp)
     930            0 :     fputs (" LOCK-COMP", dumpfile);
     931          336 :   if (attr->event_comp)
     932            0 :     fputs (" EVENT-COMP", dumpfile);
     933          336 :   if (attr->defined_assign_comp)
     934            0 :     fputs (" DEFINED-ASSIGNED-COMP", dumpfile);
     935          336 :   if (attr->unlimited_polymorphic)
     936            6 :     fputs (" UNLIMITED-POLYMORPHIC", dumpfile);
     937          336 :   if (attr->has_dtio_procs)
     938            0 :     fputs (" HAS-DTIO-PROCS", dumpfile);
     939          336 :   if (attr->caf_token)
     940            0 :     fputs (" CAF-TOKEN", dumpfile);
     941          336 :   if (attr->select_type_temporary)
     942           12 :     fputs (" SELECT-TYPE-TEMPORARY", dumpfile);
     943          336 :   if (attr->select_rank_temporary)
     944            0 :     fputs (" SELECT-RANK-TEMPORARY", dumpfile);
     945          336 :   if (attr->associate_var)
     946           12 :     fputs (" ASSOCIATE-VAR", dumpfile);
     947          336 :   if (attr->pdt_kind)
     948            0 :     fputs (" PDT-KIND", dumpfile);
     949          336 :   if (attr->pdt_len)
     950            0 :     fputs (" PDT-LEN", dumpfile);
     951          336 :   if (attr->pdt_type)
     952            0 :     fputs (" PDT-TYPE", dumpfile);
     953          336 :   if (attr->pdt_array)
     954            0 :     fputs (" PDT-ARRAY", dumpfile);
     955          336 :   if (attr->pdt_string)
     956            0 :     fputs (" PDT-STRING", dumpfile);
     957          336 :   if (attr->omp_udr_artificial_var)
     958            0 :     fputs (" OMP-UDR-ARTIFICIAL-VAR", dumpfile);
     959          336 :   if (attr->omp_udm_artificial_var)
     960            0 :     fputs (" OMP-UDM-ARTIFICIAL-VAR", dumpfile);
     961          336 :   if (attr->omp_declare_target)
     962            0 :     fputs (" OMP-DECLARE-TARGET", dumpfile);
     963          336 :   if (attr->omp_declare_target_link)
     964            0 :     fputs (" OMP-DECLARE-TARGET-LINK", dumpfile);
     965          336 :   if (attr->omp_declare_target_local)
     966            0 :     fputs (" OMP-DECLARE-TARGET-LOCAL", dumpfile);
     967          336 :   if (attr->omp_declare_target_indirect)
     968            0 :     fputs (" OMP-DECLARE-TARGET-INDIRECT", dumpfile);
     969          336 :   if (attr->omp_device_type == OMP_DEVICE_TYPE_HOST)
     970            0 :     fputs (" OMP-DEVICE-TYPE-HOST", dumpfile);
     971          336 :   if (attr->omp_device_type == OMP_DEVICE_TYPE_NOHOST)
     972            0 :     fputs (" OMP-DEVICE-TYPE-NOHOST", dumpfile);
     973          336 :   if (attr->omp_device_type == OMP_DEVICE_TYPE_ANY)
     974            0 :     fputs (" OMP-DEVICE-TYPE-ANY", dumpfile);
     975          336 :   if (attr->omp_allocate)
     976            0 :     fputs (" OMP-ALLOCATE", dumpfile);
     977              : 
     978          336 :   if (attr->oacc_declare_create)
     979            0 :     fputs (" OACC-DECLARE-CREATE", dumpfile);
     980          336 :   if (attr->oacc_declare_copyin)
     981            0 :     fputs (" OACC-DECLARE-COPYIN", dumpfile);
     982          336 :   if (attr->oacc_declare_deviceptr)
     983            0 :     fputs (" OACC-DECLARE-DEVICEPTR", dumpfile);
     984          336 :   if (attr->oacc_declare_device_resident)
     985            0 :     fputs (" OACC-DECLARE-DEVICE-RESIDENT", dumpfile);
     986              : 
     987          336 :   switch (attr->oacc_routine_lop)
     988              :     {
     989              :     case OACC_ROUTINE_LOP_NONE:
     990              :     case OACC_ROUTINE_LOP_ERROR:
     991              :       break;
     992              : 
     993            0 :     case OACC_ROUTINE_LOP_GANG:
     994            0 :       fputs (" OACC-ROUTINE-LOP-GANG", dumpfile);
     995            0 :       break;
     996              : 
     997            0 :     case OACC_ROUTINE_LOP_WORKER:
     998            0 :       fputs (" OACC-ROUTINE-LOP-WORKER", dumpfile);
     999            0 :       break;
    1000              : 
    1001            0 :     case  OACC_ROUTINE_LOP_VECTOR:
    1002            0 :       fputs (" OACC-ROUTINE-LOP-VECTOR", dumpfile);
    1003            0 :       break;
    1004              : 
    1005            0 :     case OACC_ROUTINE_LOP_SEQ:
    1006            0 :       fputs (" OACC-ROUTINE-LOP-SEQ", dumpfile);
    1007            0 :       break;
    1008              :       }
    1009              : 
    1010          336 :   if (attr->elemental)
    1011            6 :     fputs (" ELEMENTAL", dumpfile);
    1012          336 :   if (attr->pure)
    1013           12 :     fputs (" PURE", dumpfile);
    1014          336 :   if (attr->implicit_pure)
    1015            0 :     fputs (" IMPLICIT-PURE", dumpfile);
    1016          336 :   if (attr->recursive)
    1017            0 :     fputs (" RECURSIVE", dumpfile);
    1018          336 :   if (attr->unmaskable)
    1019            0 :     fputs (" UNMASKABLE", dumpfile);
    1020          336 :   if (attr->masked)
    1021            0 :     fputs (" MASKED", dumpfile);
    1022          336 :   if (attr->contained)
    1023            6 :     fputs (" CONTAINED", dumpfile);
    1024          336 :   if (attr->mod_proc)
    1025            0 :     fputs (" MOD-PROC", dumpfile);
    1026          336 :   if (attr->module_procedure)
    1027            0 :     fputs (" MODULE-PROCEDURE", dumpfile);
    1028          336 :   if (attr->public_used)
    1029            0 :     fputs (" PUBLIC_USED", dumpfile);
    1030          336 :   if (attr->array_outer_dependency)
    1031           40 :     fputs (" ARRAY-OUTER-DEPENDENCY", dumpfile);
    1032          336 :   if (attr->noreturn)
    1033            0 :     fputs (" NORETURN", dumpfile);
    1034          336 :   if (attr->always_explicit)
    1035            0 :     fputs (" ALWAYS-EXPLICIT", dumpfile);
    1036          336 :   if (attr->is_main_program)
    1037           40 :     fputs (" IS-MAIN-PROGRAM", dumpfile);
    1038          336 :   if (attr->referenced)
    1039          152 :     fputs (" REFERENCED", dumpfile);
    1040              : 
    1041          336 :   switch (attr->value_set)
    1042              :     {
    1043              :     case VALUE_UNSET:
    1044              :       break;
    1045            0 :     case VALUE_ARG:
    1046            0 :       fputs (" VALUE-SET(ARG)", dumpfile);
    1047            0 :       break;
    1048            0 :     case VALUE_INTENT_OUT:
    1049            0 :       fputs (" VALUE-SET(INTENT-OUT)", dumpfile);
    1050            0 :       break;
    1051            0 :     case VALUE_READ:
    1052            0 :       fputs (" VALUE-SET(READ)", dumpfile);
    1053            0 :       break;
    1054           12 :     case VALUE_VARDEF:
    1055           12 :       fputs (" VALUE-SET(VARDEF)", dumpfile);
    1056           12 :       break;
    1057            0 :     default:
    1058            0 :       gfc_internal_error ("Wrong value for value_set");
    1059              :     }
    1060              : 
    1061          336 :   if (attr->allocated)
    1062           12 :     fputs (" ALLOCATED", dumpfile);
    1063              : 
    1064          336 :   switch (attr->value_used)
    1065              :     {
    1066              :     case VALUE_UNUSED:
    1067              :       break;
    1068            0 :     case VALUE_MAYBE_USED:
    1069            0 :       fputs (" VALUE-USED(MAYBE-USED)", dumpfile);
    1070            0 :       break;
    1071           12 :     case VALUE_USED:
    1072           12 :       fputs (" VALUE-USED(USED)", dumpfile);
    1073           12 :       break;
    1074            0 :     case VALUE_INTENT_IN:
    1075            0 :       fputs (" VALUE-USED(INTENT-IN)", dumpfile);
    1076            0 :       break;
    1077            0 :     case VALUE_VALUE_ARG:
    1078            0 :       fputs (" VALUE-USED(VALUE-ARG)", dumpfile);
    1079            0 :         break;
    1080            0 :     default:
    1081            0 :       gfc_internal_error ("Wrong value for value_used");
    1082              :     }
    1083              : 
    1084          336 :   if (attr->oacc_routine_nohost)
    1085            0 :     fputs (" OACC-ROUTINE-NOHOST", dumpfile);
    1086          336 :   if (attr->temporary)
    1087            0 :     fputs (" TEMPORARY", dumpfile);
    1088          336 :   if (attr->assign)
    1089            0 :     fputs (" ASSIGN", dumpfile);
    1090          336 :   if (attr->not_always_present)
    1091            0 :     fputs (" NOT-ALWAYS-PRESENT", dumpfile);
    1092          336 :   if (attr->implied_index)
    1093            0 :     fputs (" IMPLIED-INDEX", dumpfile);
    1094          336 :   if (attr->proc_pointer)
    1095            0 :     fputs (" PROC-POINTER", dumpfile);
    1096          336 :   if (attr->fe_temp)
    1097            0 :     fputs (" FE-TEMP", dumpfile);
    1098          336 :   if (attr->automatic)
    1099            0 :     fputs (" AUTOMATIC", dumpfile);
    1100          336 :   if (attr->class_pointer)
    1101            0 :     fputs (" CLASS-POINTER", dumpfile);
    1102          336 :   if (attr->used_in_submodule)
    1103            0 :     fputs (" USED-IN-SUBMODULE", dumpfile);
    1104          336 :   if (attr->use_only)
    1105            0 :     fputs (" USE-ONLY", dumpfile);
    1106          336 :   if (attr->use_rename)
    1107            0 :     fputs (" USE-RENAME", dumpfile);
    1108          336 :   if (attr->imported)
    1109            0 :     fputs (" IMPORTED", dumpfile);
    1110          336 :   if (attr->host_assoc)
    1111           12 :     fputs (" HOST-ASSOC", dumpfile);
    1112          336 :   if (attr->generic)
    1113           10 :     fputs (" GENERIC", dumpfile);
    1114          336 :   if (attr->generic_copy)
    1115            0 :     fputs (" GENERIC-COPY", dumpfile);
    1116          336 :   if (attr->untyped)
    1117            0 :     fputs (" UNTYPED", dumpfile);
    1118          336 :   if (attr->extension)
    1119            6 :     fprintf (dumpfile, " EXTENSION(%u)", attr->extension);
    1120          336 :   if (attr->is_class)
    1121           18 :     fputs (" IS-CLASS", dumpfile);
    1122          336 :   if (attr->class_ok)
    1123           18 :     fputs (" CLASS-OK", dumpfile);
    1124          336 :   if (attr->vtab)
    1125           12 :     fputs (" VTAB", dumpfile);
    1126          336 :   if (attr->vtype)
    1127           12 :     fputs (" VTYPE", dumpfile);
    1128          336 :   if (attr->module_procedure)
    1129            0 :     fputs (" MODULE-PROCEDURE", dumpfile);
    1130          336 :   if (attr->if_source == IFSRC_DECL)
    1131           30 :     fputs (" IFSRC-DECL", dumpfile);
    1132          336 :   if (attr->if_source == IFSRC_IFBODY)
    1133            0 :     fputs (" IFSRC-IFBODY", dumpfile);
    1134              : 
    1135         4368 :   for (int i = 0; i < EXT_ATTR_LAST; i++)
    1136              :     {
    1137         4032 :       if (attr->ext_attr & (1 << i))
    1138              :         {
    1139            0 :           fputs (" ATTRIBUTE-", dumpfile);
    1140            0 :           for (const char *p = ext_attr_list[i].name; p && *p; p++)
    1141            0 :             putc (TOUPPER (*p), dumpfile);
    1142              :         }
    1143              :     }
    1144              : 
    1145          336 :   fputc (')', dumpfile);
    1146          336 : }
    1147              : 
    1148              : 
    1149              : /* Show components of a derived type.  */
    1150              : 
    1151              : static void
    1152           40 : show_components (gfc_symbol *sym)
    1153              : {
    1154           40 :   gfc_component *c;
    1155              : 
    1156          182 :   for (c = sym->components; c; c = c->next)
    1157              :     {
    1158          142 :       show_indent ();
    1159          142 :       fprintf (dumpfile, "(%s ", c->name);
    1160          142 :       show_typespec (&c->ts);
    1161          142 :       if (c->kind_expr)
    1162              :         {
    1163            0 :           fputs (" kind_expr: ", dumpfile);
    1164            0 :           show_expr (c->kind_expr);
    1165              :         }
    1166          142 :       if (c->param_list)
    1167              :         {
    1168            0 :           fputs ("PDT parameters", dumpfile);
    1169            0 :           show_actual_arglist (c->param_list);
    1170              :         }
    1171              : 
    1172          142 :       if (c->attr.allocatable)
    1173           12 :         fputs (" ALLOCATABLE", dumpfile);
    1174          142 :       if (c->attr.pdt_kind)
    1175            0 :         fputs (" KIND", dumpfile);
    1176          142 :       if (c->attr.pdt_len)
    1177            0 :         fputs (" LEN", dumpfile);
    1178          142 :       if (c->attr.pointer)
    1179           48 :         fputs (" POINTER", dumpfile);
    1180          142 :       if (c->attr.proc_pointer)
    1181           36 :         fputs (" PPC", dumpfile);
    1182          142 :       if (c->attr.dimension)
    1183            0 :         fputs (" DIMENSION", dumpfile);
    1184          142 :       fputc (' ', dumpfile);
    1185          142 :       show_array_spec (c->as);
    1186          142 :       if (c->attr.access)
    1187          136 :         fprintf (dumpfile, " %s", gfc_code2string (access_types, c->attr.access));
    1188          142 :       fputc (')', dumpfile);
    1189          142 :       if (c->next != NULL)
    1190          102 :         fputc (' ', dumpfile);
    1191              :     }
    1192           40 : }
    1193              : 
    1194              : 
    1195              : /* Show the f2k_derived namespace with procedure bindings.  */
    1196              : 
    1197              : static void
    1198            0 : show_typebound_proc (gfc_typebound_proc* tb, const char* name)
    1199              : {
    1200            0 :   show_indent ();
    1201              : 
    1202            0 :   if (tb->is_generic)
    1203            0 :     fputs ("GENERIC", dumpfile);
    1204              :   else
    1205              :     {
    1206            0 :       fputs ("PROCEDURE, ", dumpfile);
    1207            0 :       if (tb->nopass)
    1208            0 :         fputs ("NOPASS", dumpfile);
    1209              :       else
    1210              :         {
    1211            0 :           if (tb->pass_arg)
    1212            0 :             fprintf (dumpfile, "PASS(%s)", tb->pass_arg);
    1213              :           else
    1214            0 :             fputs ("PASS", dumpfile);
    1215              :         }
    1216            0 :       if (tb->non_overridable)
    1217            0 :         fputs (", NON_OVERRIDABLE", dumpfile);
    1218              :     }
    1219              : 
    1220            0 :   if (tb->access == ACCESS_PUBLIC)
    1221            0 :     fputs (", PUBLIC", dumpfile);
    1222              :   else
    1223            0 :     fputs (", PRIVATE", dumpfile);
    1224              : 
    1225            0 :   fprintf (dumpfile, " :: %s => ", name);
    1226              : 
    1227            0 :   if (tb->is_generic)
    1228              :     {
    1229            0 :       gfc_tbp_generic* g;
    1230            0 :       for (g = tb->u.generic; g; g = g->next)
    1231              :         {
    1232            0 :           fputs (g->specific_st->name, dumpfile);
    1233            0 :           if (g->next)
    1234            0 :             fputs (", ", dumpfile);
    1235              :         }
    1236              :     }
    1237              :   else
    1238            0 :     fputs (tb->u.specific->n.sym->name, dumpfile);
    1239            0 : }
    1240              : 
    1241              : static void
    1242            0 : show_typebound_symtree (gfc_symtree* st)
    1243              : {
    1244            0 :   gcc_assert (st->n.tb);
    1245            0 :   show_typebound_proc (st->n.tb, st->name);
    1246            0 : }
    1247              : 
    1248              : static void
    1249           24 : show_f2k_derived (gfc_namespace* f2k)
    1250              : {
    1251           24 :   gfc_finalizer* f;
    1252           24 :   int op;
    1253              : 
    1254           24 :   show_indent ();
    1255           24 :   fputs ("Procedure bindings:", dumpfile);
    1256           24 :   ++show_level;
    1257              : 
    1258              :   /* Finalizer bindings.  */
    1259           24 :   for (f = f2k->finalizers; f; f = f->next)
    1260              :     {
    1261            0 :       show_indent ();
    1262            0 :       fprintf (dumpfile, "FINAL %s", f->proc_tree->n.sym->name);
    1263              :     }
    1264              : 
    1265              :   /* Type-bound procedures.  */
    1266           24 :   gfc_traverse_symtree (f2k->tb_sym_root, &show_typebound_symtree);
    1267              : 
    1268           24 :   --show_level;
    1269              : 
    1270           24 :   show_indent ();
    1271           24 :   fputs ("Operator bindings:", dumpfile);
    1272           24 :   ++show_level;
    1273              : 
    1274              :   /* User-defined operators.  */
    1275           24 :   gfc_traverse_symtree (f2k->tb_uop_root, &show_typebound_symtree);
    1276              : 
    1277              :   /* Intrinsic operators.  */
    1278          720 :   for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; ++op)
    1279          672 :     if (f2k->tb_op[op])
    1280            0 :       show_typebound_proc (f2k->tb_op[op],
    1281              :                            gfc_op2string ((gfc_intrinsic_op) op));
    1282              : 
    1283           24 :   --show_level;
    1284           24 : }
    1285              : 
    1286              : 
    1287              : /* Show a symbol.  If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we
    1288              :    show the interface.  Information needed to reconstruct the list of
    1289              :    specific interfaces associated with a generic symbol is done within
    1290              :    that symbol.  */
    1291              : 
    1292              : static void
    1293          336 : show_symbol (gfc_symbol *sym)
    1294              : {
    1295          336 :   gfc_formal_arglist *formal;
    1296          336 :   gfc_interface *intr;
    1297          336 :   int i,len;
    1298              : 
    1299          336 :   if (sym == NULL)
    1300              :     return;
    1301              : 
    1302          336 :   fprintf (dumpfile, "|| symbol: '%s' ", sym->name);
    1303          336 :   len = strlen (sym->name);
    1304         1704 :   for (i=len; i<12; i++)
    1305         1368 :     fputc(' ', dumpfile);
    1306              : 
    1307          336 :   if (sym->binding_label)
    1308            0 :       fprintf (dumpfile,"|| binding_label: '%s' ", sym->binding_label);
    1309              : 
    1310          336 :   ++show_level;
    1311              : 
    1312          336 :   show_indent ();
    1313          336 :   fputs ("type spec : ", dumpfile);
    1314          336 :   show_typespec (&sym->ts);
    1315              : 
    1316          336 :   show_indent ();
    1317          336 :   fputs ("attributes: ", dumpfile);
    1318          336 :   show_attr (&sym->attr, sym->module);
    1319              : 
    1320          336 :   if (sym->value)
    1321              :     {
    1322          112 :       show_indent ();
    1323          112 :       fputs ("value: ", dumpfile);
    1324          112 :       show_expr (sym->value);
    1325              :     }
    1326              : 
    1327          336 :   if (sym->ts.type != BT_CLASS && sym->as)
    1328              :     {
    1329            0 :       show_indent ();
    1330            0 :       fputs ("Array spec:", dumpfile);
    1331            0 :       show_array_spec (sym->as);
    1332              :     }
    1333          336 :   else if (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->as)
    1334              :     {
    1335            0 :       show_indent ();
    1336            0 :       fputs ("Array spec:", dumpfile);
    1337            0 :       show_array_spec (CLASS_DATA (sym)->as);
    1338              :     }
    1339              : 
    1340          336 :   if (sym->generic)
    1341              :     {
    1342           10 :       show_indent ();
    1343           10 :       fputs ("Generic interfaces:", dumpfile);
    1344           20 :       for (intr = sym->generic; intr; intr = intr->next)
    1345           10 :         fprintf (dumpfile, " %s", intr->sym->name);
    1346              :     }
    1347              : 
    1348          336 :   if (sym->result)
    1349              :     {
    1350           44 :       show_indent ();
    1351           44 :       fprintf (dumpfile, "result: %s", sym->result->name);
    1352              :     }
    1353              : 
    1354          336 :   if (sym->components)
    1355              :     {
    1356           40 :       show_indent ();
    1357           40 :       fputs ("components: ", dumpfile);
    1358           40 :       show_components (sym);
    1359              :     }
    1360              : 
    1361          336 :   if (sym->f2k_derived)
    1362              :     {
    1363           24 :       show_indent ();
    1364           24 :       if (sym->hash_value)
    1365            6 :         fprintf (dumpfile, "hash: %d", sym->hash_value);
    1366           24 :       show_f2k_derived (sym->f2k_derived);
    1367              :     }
    1368              : 
    1369          336 :   if (sym->formal)
    1370              :     {
    1371           24 :       show_indent ();
    1372           24 :       fputs ("Formal arglist:", dumpfile);
    1373              : 
    1374           70 :       for (formal = sym->formal; formal; formal = formal->next)
    1375              :         {
    1376           46 :           if (formal->sym != NULL)
    1377           46 :             fprintf (dumpfile, " %s", formal->sym->name);
    1378              :           else
    1379            0 :             fputs (" [Alt Return]", dumpfile);
    1380              :         }
    1381              :     }
    1382              : 
    1383          336 :   if (sym->formal_ns && (sym->formal_ns->proc_name != sym)
    1384            0 :       && sym->attr.proc != PROC_ST_FUNCTION
    1385            0 :       && !sym->attr.entry)
    1386              :     {
    1387            0 :       show_indent ();
    1388            0 :       fputs ("Formal namespace", dumpfile);
    1389            0 :       show_namespace (sym->formal_ns);
    1390              :     }
    1391              : 
    1392          336 :   if (sym->attr.flavor == FL_VARIABLE
    1393           60 :       && sym->param_list)
    1394              :     {
    1395            0 :       show_indent ();
    1396            0 :       fputs ("PDT parameters", dumpfile);
    1397            0 :       show_actual_arglist (sym->param_list);
    1398              :     }
    1399              : 
    1400          336 :   if (sym->attr.flavor == FL_NAMELIST)
    1401              :     {
    1402            0 :       gfc_namelist *nl;
    1403            0 :       show_indent ();
    1404            0 :       fputs ("variables : ", dumpfile);
    1405            0 :       for (nl = sym->namelist; nl; nl = nl->next)
    1406            0 :         fprintf (dumpfile, " %s",nl->sym->name);
    1407              :     }
    1408              : 
    1409          336 :   --show_level;
    1410              : }
    1411              : 
    1412              : 
    1413              : /* Show a user-defined operator.  Just prints an operator
    1414              :    and the name of the associated subroutine, really.  */
    1415              : 
    1416              : static void
    1417            0 : show_uop (gfc_user_op *uop)
    1418              : {
    1419            0 :   gfc_interface *intr;
    1420              : 
    1421            0 :   show_indent ();
    1422            0 :   fprintf (dumpfile, "%s:", uop->name);
    1423              : 
    1424            0 :   for (intr = uop->op; intr; intr = intr->next)
    1425            0 :     fprintf (dumpfile, " %s", intr->sym->name);
    1426            0 : }
    1427              : 
    1428              : 
    1429              : /* Workhorse function for traversing the user operator symtree.  */
    1430              : 
    1431              : static void
    1432       358111 : traverse_uop (gfc_symtree *st, void (*func) (gfc_user_op *))
    1433              : {
    1434       358676 :   if (st == NULL)
    1435       358111 :     return;
    1436              : 
    1437          565 :   (*func) (st->n.uop);
    1438              : 
    1439          565 :   traverse_uop (st->left, func);
    1440          565 :   traverse_uop (st->right, func);
    1441              : }
    1442              : 
    1443              : 
    1444              : /* Traverse the tree of user operator nodes.  */
    1445              : 
    1446              : void
    1447       357546 : gfc_traverse_user_op (gfc_namespace *ns, void (*func) (gfc_user_op *))
    1448              : {
    1449       357546 :   traverse_uop (ns->uop_root, func);
    1450       357546 : }
    1451              : 
    1452              : 
    1453              : /* Function to display a common block.  */
    1454              : 
    1455              : static void
    1456            0 : show_common (gfc_symtree *st)
    1457              : {
    1458            0 :   gfc_symbol *s;
    1459              : 
    1460            0 :   show_indent ();
    1461            0 :   fprintf (dumpfile, "common: /%s/ ", st->name);
    1462              : 
    1463            0 :   s = st->n.common->head;
    1464            0 :   while (s)
    1465              :     {
    1466            0 :       fprintf (dumpfile, "%s", s->name);
    1467            0 :       s = s->common_next;
    1468            0 :       if (s)
    1469            0 :         fputs (", ", dumpfile);
    1470              :     }
    1471            0 :   fputc ('\n', dumpfile);
    1472            0 : }
    1473              : 
    1474              : 
    1475              : /* Worker function to display the symbol tree.  */
    1476              : 
    1477              : static void
    1478          348 : show_symtree (gfc_symtree *st)
    1479              : {
    1480          348 :   int len, i;
    1481              : 
    1482          348 :   show_indent ();
    1483              : 
    1484          348 :   len = strlen(st->name);
    1485          348 :   fprintf (dumpfile, "symtree: '%s'", st->name);
    1486              : 
    1487         2160 :   for (i=len; i<12; i++)
    1488         1464 :     fputc(' ', dumpfile);
    1489              : 
    1490          348 :   if (st->ambiguous)
    1491            0 :     fputs( " Ambiguous", dumpfile);
    1492              : 
    1493          348 :   if (st->n.sym->ns != gfc_current_ns)
    1494           12 :     fprintf (dumpfile, "|| symbol: '%s' from namespace '%s'", st->n.sym->name,
    1495           12 :              st->n.sym->ns->proc_name->name);
    1496              :   else
    1497          336 :     show_symbol (st->n.sym);
    1498          348 : }
    1499              : 
    1500              : 
    1501              : /******************* Show gfc_code structures **************/
    1502              : 
    1503              : 
    1504              : /* Show a list of code structures.  Mutually recursive with
    1505              :    show_code_node().  */
    1506              : 
    1507              : static void
    1508          112 : show_code (int level, gfc_code *c)
    1509              : {
    1510          276 :   for (; c; c = c->next)
    1511          164 :     show_code_node (level, c);
    1512           60 : }
    1513              : 
    1514              : static void
    1515            0 : show_iterator (gfc_namespace *ns)
    1516              : {
    1517            0 :   for (gfc_symbol *sym = ns->omp_affinity_iterators; sym; sym = sym->tlink)
    1518              :     {
    1519            0 :       gfc_constructor *c;
    1520            0 :       if (sym != ns->omp_affinity_iterators)
    1521            0 :         fputc (',', dumpfile);
    1522            0 :       fputs (sym->name, dumpfile);
    1523            0 :       fputc ('=', dumpfile);
    1524            0 :       c = gfc_constructor_first (sym->value->value.constructor);
    1525            0 :       show_expr (c->expr);
    1526            0 :       fputc (':', dumpfile);
    1527            0 :       c = gfc_constructor_next (c);
    1528            0 :       show_expr (c->expr);
    1529            0 :       c = gfc_constructor_next (c);
    1530            0 :       if (c)
    1531              :         {
    1532            0 :           fputc (':', dumpfile);
    1533            0 :           show_expr (c->expr);
    1534              :         }
    1535              :     }
    1536            0 : }
    1537              : 
    1538              : static void
    1539            0 : show_omp_namelist (int list_type, gfc_omp_namelist *n)
    1540              : {
    1541            0 :   gfc_namespace *ns_iter = NULL, *ns_curr = gfc_current_ns;
    1542            0 :   gfc_omp_namelist *n2 = n;
    1543            0 :   for (; n; n = n->next)
    1544              :     {
    1545            0 :       gfc_current_ns = ns_curr;
    1546            0 :       if (list_type == OMP_LIST_AFFINITY || list_type == OMP_LIST_DEPEND
    1547              :           || list_type == OMP_LIST_MAP
    1548            0 :           || list_type == OMP_LIST_TO || list_type == OMP_LIST_FROM)
    1549              :         {
    1550            0 :           gfc_current_ns = n->u2.ns ? n->u2.ns : ns_curr;
    1551            0 :           if (n->u2.ns != ns_iter)
    1552              :             {
    1553            0 :               if (n != n2)
    1554              :                 {
    1555            0 :                   fputs (") ", dumpfile);
    1556            0 :                   if (list_type == OMP_LIST_AFFINITY)
    1557            0 :                     fputs ("AFFINITY (", dumpfile);
    1558            0 :                   else if (n->u.depend_doacross_op == OMP_DOACROSS_SINK_FIRST)
    1559            0 :                     fputs ("DOACROSS (", dumpfile);
    1560            0 :                   else if (list_type == OMP_LIST_DEPEND)
    1561            0 :                     fputs ("DEPEND (", dumpfile);
    1562            0 :                   else if (list_type == OMP_LIST_MAP)
    1563            0 :                     fputs ("MAP (", dumpfile);
    1564            0 :                   else if (list_type == OMP_LIST_TO)
    1565            0 :                     fputs ("TO (", dumpfile);
    1566            0 :                   else if (list_type == OMP_LIST_FROM)
    1567            0 :                     fputs ("FROM (", dumpfile);
    1568              :                   else
    1569              :                     gcc_unreachable ();
    1570              :                 }
    1571            0 :               if (n->u2.ns)
    1572              :                 {
    1573            0 :                   fputs ("ITERATOR(", dumpfile);
    1574            0 :                   show_iterator (n->u2.ns);
    1575            0 :                   fputc (')', dumpfile);
    1576            0 :                   fputc (list_type == OMP_LIST_AFFINITY ? ':' : ',', dumpfile);
    1577              :                 }
    1578              :             }
    1579            0 :           ns_iter = n->u2.ns;
    1580              :         }
    1581            0 :       else if (list_type == OMP_LIST_INIT && n != n2)
    1582            0 :         fputs (") INIT(", dumpfile);
    1583            0 :       if (list_type == OMP_LIST_ALLOCATE)
    1584              :         {
    1585            0 :           if (n->u2.allocator)
    1586              :             {
    1587            0 :               fputs ("allocator(", dumpfile);
    1588            0 :               show_expr (n->u2.allocator);
    1589            0 :               fputc (')', dumpfile);
    1590              :             }
    1591            0 :           if (n->expr && n->u.align)
    1592            0 :             fputc (',', dumpfile);
    1593            0 :           if (n->u.align)
    1594              :             {
    1595            0 :               fputs ("align(", dumpfile);
    1596            0 :               show_expr (n->u.align);
    1597            0 :               fputc (')', dumpfile);
    1598              :             }
    1599            0 :           if (n->u2.allocator || n->u.align)
    1600            0 :             fputc (':', dumpfile);
    1601            0 :           if (n->expr)
    1602            0 :             show_expr (n->expr);
    1603              :           else
    1604            0 :             fputs (n->sym->name, dumpfile);
    1605            0 :           if (n->next)
    1606            0 :             fputs (") ALLOCATE(", dumpfile);
    1607            0 :           continue;
    1608              :         }
    1609            0 :       if ((list_type == OMP_LIST_MAP || list_type == OMP_LIST_CACHE)
    1610            0 :           && n->u.map.readonly)
    1611            0 :         fputs ("readonly,", dumpfile);
    1612            0 :       if (list_type == OMP_LIST_REDUCTION)
    1613            0 :         switch (n->u.reduction_op)
    1614              :           {
    1615            0 :           case OMP_REDUCTION_PLUS:
    1616            0 :           case OMP_REDUCTION_TIMES:
    1617            0 :           case OMP_REDUCTION_MINUS:
    1618            0 :           case OMP_REDUCTION_AND:
    1619            0 :           case OMP_REDUCTION_OR:
    1620            0 :           case OMP_REDUCTION_EQV:
    1621            0 :           case OMP_REDUCTION_NEQV:
    1622            0 :             fprintf (dumpfile, "%s:",
    1623              :                      gfc_op2string ((gfc_intrinsic_op) n->u.reduction_op));
    1624            0 :             break;
    1625            0 :           case OMP_REDUCTION_MAX: fputs ("max:", dumpfile); break;
    1626            0 :           case OMP_REDUCTION_MIN: fputs ("min:", dumpfile); break;
    1627            0 :           case OMP_REDUCTION_IAND: fputs ("iand:", dumpfile); break;
    1628            0 :           case OMP_REDUCTION_IOR: fputs ("ior:", dumpfile); break;
    1629            0 :           case OMP_REDUCTION_IEOR: fputs ("ieor:", dumpfile); break;
    1630            0 :           case OMP_REDUCTION_USER:
    1631            0 :             if (n->u2.udr)
    1632            0 :               fprintf (dumpfile, "%s:", n->u2.udr->udr->name);
    1633              :             break;
    1634              :           default: break;
    1635              :           }
    1636            0 :       else if (list_type == OMP_LIST_DEPEND)
    1637            0 :         switch (n->u.depend_doacross_op)
    1638              :           {
    1639            0 :           case OMP_DEPEND_IN: fputs ("in:", dumpfile); break;
    1640            0 :           case OMP_DEPEND_OUT: fputs ("out:", dumpfile); break;
    1641            0 :           case OMP_DEPEND_INOUT: fputs ("inout:", dumpfile); break;
    1642            0 :           case OMP_DEPEND_INOUTSET: fputs ("inoutset:", dumpfile); break;
    1643            0 :           case OMP_DEPEND_DEPOBJ: fputs ("depobj:", dumpfile); break;
    1644            0 :           case OMP_DEPEND_MUTEXINOUTSET:
    1645            0 :             fputs ("mutexinoutset:", dumpfile);
    1646            0 :             break;
    1647            0 :           case OMP_DEPEND_SINK_FIRST:
    1648            0 :           case OMP_DOACROSS_SINK_FIRST:
    1649            0 :             fputs ("sink:", dumpfile);
    1650            0 :             while (1)
    1651              :               {
    1652            0 :                 if (!n->sym)
    1653            0 :                   fputs ("omp_cur_iteration", dumpfile);
    1654              :                 else
    1655            0 :                   fprintf (dumpfile, "%s", n->sym->name);
    1656            0 :                 if (n->expr)
    1657              :                   {
    1658            0 :                     fputc ('+', dumpfile);
    1659            0 :                     show_expr (n->expr);
    1660              :                   }
    1661            0 :                 if (n->next == NULL)
    1662              :                   break;
    1663            0 :                 else if (n->next->u.depend_doacross_op != OMP_DOACROSS_SINK)
    1664              :                   {
    1665            0 :                     if (n->next->u.depend_doacross_op
    1666              :                         == OMP_DOACROSS_SINK_FIRST)
    1667            0 :                       fputs (") DOACROSS(", dumpfile);
    1668              :                     else
    1669            0 :                       fputs (") DEPEND(", dumpfile);
    1670              :                     break;
    1671              :                   }
    1672            0 :                 fputc (',', dumpfile);
    1673            0 :                 n = n->next;
    1674              :               }
    1675            0 :             continue;
    1676              :           default: break;
    1677              :           }
    1678            0 :       else if (list_type == OMP_LIST_MAP)
    1679            0 :         switch (n->u.map.op)
    1680              :           {
    1681            0 :           case OMP_MAP_ALLOC: fputs ("alloc:", dumpfile); break;
    1682            0 :           case OMP_MAP_TO: fputs ("to:", dumpfile); break;
    1683            0 :           case OMP_MAP_FROM: fputs ("from:", dumpfile); break;
    1684            0 :           case OMP_MAP_TOFROM: fputs ("tofrom:", dumpfile); break;
    1685            0 :           case OMP_MAP_PRESENT_ALLOC: fputs ("present,alloc:", dumpfile); break;
    1686            0 :           case OMP_MAP_PRESENT_TO: fputs ("present,to:", dumpfile); break;
    1687            0 :           case OMP_MAP_PRESENT_FROM: fputs ("present,from:", dumpfile); break;
    1688            0 :           case OMP_MAP_PRESENT_TOFROM:
    1689            0 :             fputs ("present,tofrom:", dumpfile); break;
    1690            0 :           case OMP_MAP_ALWAYS_TO: fputs ("always,to:", dumpfile); break;
    1691            0 :           case OMP_MAP_ALWAYS_FROM: fputs ("always,from:", dumpfile); break;
    1692            0 :           case OMP_MAP_ALWAYS_TOFROM: fputs ("always,tofrom:", dumpfile); break;
    1693            0 :           case OMP_MAP_ALWAYS_PRESENT_TO:
    1694            0 :             fputs ("always,present,to:", dumpfile); break;
    1695            0 :           case OMP_MAP_ALWAYS_PRESENT_FROM:
    1696            0 :             fputs ("always,present,from:", dumpfile); break;
    1697            0 :           case OMP_MAP_ALWAYS_PRESENT_TOFROM:
    1698            0 :             fputs ("always,present,tofrom:", dumpfile); break;
    1699            0 :           case OMP_MAP_DELETE: fputs ("delete:", dumpfile); break;
    1700            0 :           case OMP_MAP_RELEASE: fputs ("release:", dumpfile); break;
    1701            0 :           case OMP_MAP_UNSET: fputs ("unset:", dumpfile); break;
    1702              :           default: break;
    1703              :           }
    1704            0 :       else if (list_type == OMP_LIST_LINEAR && n->u.linear.old_modifier)
    1705            0 :         switch (n->u.linear.op)
    1706              :           {
    1707            0 :           case OMP_LINEAR_REF: fputs ("ref(", dumpfile); break;
    1708            0 :           case OMP_LINEAR_VAL: fputs ("val(", dumpfile); break;
    1709            0 :           case OMP_LINEAR_UVAL: fputs ("uval(", dumpfile); break;
    1710              :           default: break;
    1711              :           }
    1712            0 :       else if (list_type == OMP_LIST_USES_ALLOCATORS)
    1713              :         {
    1714            0 :           if (n->u.memspace_sym)
    1715              :             {
    1716            0 :               fputs ("memspace(", dumpfile);
    1717            0 :               fputs (n->sym->name, dumpfile);
    1718            0 :               fputc (')', dumpfile);
    1719              :             }
    1720            0 :           if (n->u.memspace_sym && n->u2.traits_sym)
    1721            0 :             fputc (',', dumpfile);
    1722            0 :           if (n->u2.traits_sym)
    1723              :             {
    1724            0 :               fputs ("traits(", dumpfile);
    1725            0 :               fputs (n->u2.traits_sym->name, dumpfile);
    1726            0 :               fputc (')', dumpfile);
    1727              :             }
    1728            0 :           if (n->u.memspace_sym || n->u2.traits_sym)
    1729            0 :             fputc (':', dumpfile);
    1730            0 :           fputs (n->sym->name, dumpfile);
    1731            0 :           if (n->next)
    1732            0 :             fputs (", ", dumpfile);
    1733            0 :           continue;
    1734              :         }
    1735            0 :       else if (list_type == OMP_LIST_INIT)
    1736              :         {
    1737            0 :           if (n->u.init.target)
    1738            0 :             fputs ("target,", dumpfile);
    1739            0 :           if (n->u.init.targetsync)
    1740            0 :             fputs ("targetsync,", dumpfile);
    1741            0 :           if (n->u2.init_interop)
    1742              :             {
    1743            0 :               char *str = n->u2.init_interop;
    1744            0 :               fputs ("prefer_type(", dumpfile);
    1745            0 :               while (str[0] == (char) GOMP_INTEROP_IFR_SEPARATOR)
    1746              :                 {
    1747            0 :                   bool has_fr = false;
    1748            0 :                   fputc ('{', dumpfile);
    1749            0 :                   str++;
    1750            0 :                   while (str[0] != (char) GOMP_INTEROP_IFR_SEPARATOR)
    1751              :                     {
    1752            0 :                       if (has_fr)
    1753            0 :                         fputc (',', dumpfile);
    1754            0 :                       has_fr = true;
    1755            0 :                       fputs ("fr(\"", dumpfile);
    1756            0 :                       fputs (omp_get_name_from_fr_id (str[0]), dumpfile);
    1757            0 :                       fputs ("\")", dumpfile);
    1758            0 :                       str++;
    1759              :                     }
    1760            0 :                   str++;
    1761            0 :                   if (has_fr && str[0] != '\0')
    1762            0 :                     fputc (',', dumpfile);
    1763            0 :                   while (str[0] != '\0')
    1764              :                     {
    1765            0 :                       fputs ("attr(\"", dumpfile);
    1766            0 :                       fputs (str, dumpfile);
    1767            0 :                       fputs ("\")", dumpfile);
    1768            0 :                       str += strlen (str) + 1;
    1769            0 :                       if (str[0] != '\0')
    1770            0 :                         fputc (',', dumpfile);
    1771              :                     }
    1772            0 :                   str++;
    1773            0 :                   fputc ('}', dumpfile);
    1774            0 :                   if (str[0] != '\0')
    1775            0 :                     fputs (", ", dumpfile);
    1776              :                 }
    1777            0 :               fputc (')', dumpfile);
    1778              :             }
    1779            0 :           fputc (':', dumpfile);
    1780              :         }
    1781            0 :       fprintf (dumpfile, "%s", n->sym ? n->sym->name : "omp_all_memory");
    1782            0 :       if (list_type == OMP_LIST_LINEAR && n->u.linear.op != OMP_LINEAR_DEFAULT)
    1783            0 :         fputc (')', dumpfile);
    1784            0 :       if (n->expr)
    1785              :         {
    1786            0 :           fputc (':', dumpfile);
    1787            0 :           show_expr (n->expr);
    1788              :         }
    1789            0 :       if (n->next)
    1790            0 :         fputc (',', dumpfile);
    1791              :     }
    1792            0 :   gfc_current_ns = ns_curr;
    1793            0 : }
    1794              : 
    1795              : static void
    1796            0 : show_omp_assumes (gfc_omp_assumptions *assume)
    1797              : {
    1798            0 :   for (int i = 0; i < assume->n_absent; i++)
    1799              :     {
    1800            0 :       fputs (" ABSENT (", dumpfile);
    1801            0 :       fputs (gfc_ascii_statement (assume->absent[i], true), dumpfile);
    1802            0 :       fputc (')', dumpfile);
    1803              :     }
    1804            0 :   for (int i = 0; i < assume->n_contains; i++)
    1805              :     {
    1806            0 :       fputs (" CONTAINS (", dumpfile);
    1807            0 :       fputs (gfc_ascii_statement (assume->contains[i], true), dumpfile);
    1808            0 :       fputc (')', dumpfile);
    1809              :     }
    1810            0 :   for (gfc_expr_list *el = assume->holds; el; el = el->next)
    1811              :     {
    1812            0 :       fputs (" HOLDS (", dumpfile);
    1813            0 :       show_expr (el->expr);
    1814            0 :       fputc (')', dumpfile);
    1815              :     }
    1816            0 :   if (assume->no_openmp)
    1817            0 :     fputs (" NO_OPENMP", dumpfile);
    1818            0 :   if (assume->no_openmp_constructs)
    1819            0 :     fputs (" NO_OPENMP_CONSTRUCTS", dumpfile);
    1820            0 :   if (assume->no_openmp_routines)
    1821            0 :     fputs (" NO_OPENMP_ROUTINES", dumpfile);
    1822            0 :   if (assume->no_parallelism)
    1823            0 :     fputs (" NO_PARALLELISM", dumpfile);
    1824            0 : }
    1825              : 
    1826              : /* Show OpenMP or OpenACC clauses.  */
    1827              : 
    1828              : static void
    1829            0 : show_omp_clauses (gfc_omp_clauses *omp_clauses)
    1830              : {
    1831            0 :   int list_type, i;
    1832              : 
    1833            0 :   switch (omp_clauses->cancel)
    1834              :     {
    1835              :     case OMP_CANCEL_UNKNOWN:
    1836              :       break;
    1837            0 :     case OMP_CANCEL_PARALLEL:
    1838            0 :       fputs (" PARALLEL", dumpfile);
    1839            0 :       break;
    1840            0 :     case OMP_CANCEL_SECTIONS:
    1841            0 :       fputs (" SECTIONS", dumpfile);
    1842            0 :       break;
    1843            0 :     case OMP_CANCEL_DO:
    1844            0 :       fputs (" DO", dumpfile);
    1845            0 :       break;
    1846            0 :     case OMP_CANCEL_TASKGROUP:
    1847            0 :       fputs (" TASKGROUP", dumpfile);
    1848            0 :       break;
    1849              :     }
    1850            0 :   if (omp_clauses->if_expr)
    1851              :     {
    1852            0 :       fputs (" IF(", dumpfile);
    1853            0 :       show_expr (omp_clauses->if_expr);
    1854            0 :       fputc (')', dumpfile);
    1855              :     }
    1856            0 :   for (i = 0; i < OMP_IF_LAST; i++)
    1857            0 :     if (omp_clauses->if_exprs[i])
    1858              :       {
    1859            0 :         static const char *ifs[] = {
    1860              :           "CANCEL",
    1861              :           "PARALLEL",
    1862              :           "SIMD",
    1863              :           "TASK",
    1864              :           "TASKLOOP",
    1865              :           "TARGET",
    1866              :           "TARGET DATA",
    1867              :           "TARGET UPDATE",
    1868              :           "TARGET ENTER DATA",
    1869              :           "TARGET EXIT DATA"
    1870              :         };
    1871            0 :       fputs (" IF(", dumpfile);
    1872            0 :       fputs (ifs[i], dumpfile);
    1873            0 :       fputs (": ", dumpfile);
    1874            0 :       show_expr (omp_clauses->if_exprs[i]);
    1875            0 :       fputc (')', dumpfile);
    1876              :     }
    1877            0 :   if (omp_clauses->self_expr)
    1878              :     {
    1879            0 :       fputs (" SELF(", dumpfile);
    1880            0 :       show_expr (omp_clauses->self_expr);
    1881            0 :       fputc (')', dumpfile);
    1882              :     }
    1883            0 :   if (omp_clauses->final_expr)
    1884              :     {
    1885            0 :       fputs (" FINAL(", dumpfile);
    1886            0 :       show_expr (omp_clauses->final_expr);
    1887            0 :       fputc (')', dumpfile);
    1888              :     }
    1889            0 :   if (omp_clauses->num_threads)
    1890              :     {
    1891            0 :       fputs (" NUM_THREADS(", dumpfile);
    1892            0 :       show_expr (omp_clauses->num_threads);
    1893            0 :       fputc (')', dumpfile);
    1894              :     }
    1895            0 :   if (omp_clauses->async)
    1896              :     {
    1897            0 :       fputs (" ASYNC", dumpfile);
    1898            0 :       if (omp_clauses->async_expr)
    1899              :         {
    1900            0 :           fputc ('(', dumpfile);
    1901            0 :           show_expr (omp_clauses->async_expr);
    1902            0 :           fputc (')', dumpfile);
    1903              :         }
    1904              :     }
    1905            0 :   if (omp_clauses->num_gangs_expr)
    1906              :     {
    1907            0 :       fputs (" NUM_GANGS(", dumpfile);
    1908            0 :       show_expr (omp_clauses->num_gangs_expr);
    1909            0 :       fputc (')', dumpfile);
    1910              :     }
    1911            0 :   if (omp_clauses->num_workers_expr)
    1912              :     {
    1913            0 :       fputs (" NUM_WORKERS(", dumpfile);
    1914            0 :       show_expr (omp_clauses->num_workers_expr);
    1915            0 :       fputc (')', dumpfile);
    1916              :     }
    1917            0 :   if (omp_clauses->vector_length_expr)
    1918              :     {
    1919            0 :       fputs (" VECTOR_LENGTH(", dumpfile);
    1920            0 :       show_expr (omp_clauses->vector_length_expr);
    1921            0 :       fputc (')', dumpfile);
    1922              :     }
    1923            0 :   if (omp_clauses->gang)
    1924              :     {
    1925            0 :       fputs (" GANG", dumpfile);
    1926            0 :       if (omp_clauses->gang_num_expr || omp_clauses->gang_static_expr)
    1927              :         {
    1928            0 :           fputc ('(', dumpfile);
    1929            0 :           if (omp_clauses->gang_num_expr)
    1930              :             {
    1931            0 :               fprintf (dumpfile, "num:");
    1932            0 :               show_expr (omp_clauses->gang_num_expr);
    1933              :             }
    1934            0 :           if (omp_clauses->gang_num_expr && omp_clauses->gang_static)
    1935            0 :             fputc (',', dumpfile);
    1936            0 :           if (omp_clauses->gang_static)
    1937              :             {
    1938            0 :               fprintf (dumpfile, "static:");
    1939            0 :               if (omp_clauses->gang_static_expr)
    1940            0 :                 show_expr (omp_clauses->gang_static_expr);
    1941              :               else
    1942            0 :                 fputc ('*', dumpfile);
    1943              :             }
    1944            0 :           fputc (')', dumpfile);
    1945              :         }
    1946              :     }
    1947            0 :   if (omp_clauses->worker)
    1948              :     {
    1949            0 :       fputs (" WORKER", dumpfile);
    1950            0 :       if (omp_clauses->worker_expr)
    1951              :         {
    1952            0 :           fputc ('(', dumpfile);
    1953            0 :           show_expr (omp_clauses->worker_expr);
    1954            0 :           fputc (')', dumpfile);
    1955              :         }
    1956              :     }
    1957            0 :   if (omp_clauses->vector)
    1958              :     {
    1959            0 :       fputs (" VECTOR", dumpfile);
    1960            0 :       if (omp_clauses->vector_expr)
    1961              :         {
    1962            0 :           fputc ('(', dumpfile);
    1963            0 :           show_expr (omp_clauses->vector_expr);
    1964            0 :           fputc (')', dumpfile);
    1965              :         }
    1966              :     }
    1967            0 :   if (omp_clauses->sched_kind != OMP_SCHED_NONE)
    1968              :     {
    1969            0 :       const char *type;
    1970            0 :       switch (omp_clauses->sched_kind)
    1971              :         {
    1972              :         case OMP_SCHED_STATIC: type = "STATIC"; break;
    1973            0 :         case OMP_SCHED_DYNAMIC: type = "DYNAMIC"; break;
    1974            0 :         case OMP_SCHED_GUIDED: type = "GUIDED"; break;
    1975            0 :         case OMP_SCHED_RUNTIME: type = "RUNTIME"; break;
    1976            0 :         case OMP_SCHED_AUTO: type = "AUTO"; break;
    1977            0 :         default:
    1978            0 :           gcc_unreachable ();
    1979              :         }
    1980            0 :       fputs (" SCHEDULE (", dumpfile);
    1981            0 :       if (omp_clauses->sched_simd)
    1982              :         {
    1983            0 :           if (omp_clauses->sched_monotonic
    1984            0 :               || omp_clauses->sched_nonmonotonic)
    1985            0 :             fputs ("SIMD, ", dumpfile);
    1986              :           else
    1987            0 :             fputs ("SIMD: ", dumpfile);
    1988              :         }
    1989            0 :       if (omp_clauses->sched_monotonic)
    1990            0 :         fputs ("MONOTONIC: ", dumpfile);
    1991            0 :       else if (omp_clauses->sched_nonmonotonic)
    1992            0 :         fputs ("NONMONOTONIC: ", dumpfile);
    1993            0 :       fputs (type, dumpfile);
    1994            0 :       if (omp_clauses->chunk_size)
    1995              :         {
    1996            0 :           fputc (',', dumpfile);
    1997            0 :           show_expr (omp_clauses->chunk_size);
    1998              :         }
    1999            0 :       fputc (')', dumpfile);
    2000              :     }
    2001            0 :   if (omp_clauses->default_sharing != OMP_DEFAULT_UNKNOWN)
    2002              :     {
    2003            0 :       const char *type;
    2004            0 :       switch (omp_clauses->default_sharing)
    2005              :         {
    2006              :         case OMP_DEFAULT_NONE: type = "NONE"; break;
    2007            0 :         case OMP_DEFAULT_PRIVATE: type = "PRIVATE"; break;
    2008            0 :         case OMP_DEFAULT_SHARED: type = "SHARED"; break;
    2009            0 :         case OMP_DEFAULT_FIRSTPRIVATE: type = "FIRSTPRIVATE"; break;
    2010            0 :         case OMP_DEFAULT_PRESENT: type = "PRESENT"; break;
    2011            0 :         default:
    2012            0 :           gcc_unreachable ();
    2013              :         }
    2014            0 :       fprintf (dumpfile, " DEFAULT(%s)", type);
    2015              :     }
    2016            0 :   if (omp_clauses->tile_list)
    2017              :     {
    2018            0 :       gfc_expr_list *list;
    2019            0 :       fputs (" TILE(", dumpfile);
    2020            0 :       for (list = omp_clauses->tile_list; list; list = list->next)
    2021              :         {
    2022            0 :           show_expr (list->expr);
    2023            0 :           if (list->next)
    2024            0 :             fputs (", ", dumpfile);
    2025              :         }
    2026            0 :       fputc (')', dumpfile);
    2027              :     }
    2028            0 :   if (omp_clauses->wait_list)
    2029              :     {
    2030            0 :       gfc_expr_list *list;
    2031            0 :       fputs (" WAIT(", dumpfile);
    2032            0 :       for (list = omp_clauses->wait_list; list; list = list->next)
    2033              :         {
    2034            0 :           show_expr (list->expr);
    2035            0 :           if (list->next)
    2036            0 :             fputs (", ", dumpfile);
    2037              :         }
    2038            0 :       fputc (')', dumpfile);
    2039              :     }
    2040            0 :   if (omp_clauses->seq)
    2041            0 :     fputs (" SEQ", dumpfile);
    2042            0 :   if (omp_clauses->independent)
    2043            0 :     fputs (" INDEPENDENT", dumpfile);
    2044            0 :   if (omp_clauses->order_concurrent)
    2045              :     {
    2046            0 :       fputs (" ORDER(", dumpfile);
    2047            0 :       if (omp_clauses->order_unconstrained)
    2048            0 :         fputs ("UNCONSTRAINED:", dumpfile);
    2049            0 :       else if (omp_clauses->order_reproducible)
    2050            0 :         fputs ("REPRODUCIBLE:", dumpfile);
    2051            0 :       fputs ("CONCURRENT)", dumpfile);
    2052              :     }
    2053            0 :   if (omp_clauses->ordered)
    2054              :     {
    2055            0 :       if (omp_clauses->orderedc)
    2056            0 :         fprintf (dumpfile, " ORDERED(%d)", omp_clauses->orderedc);
    2057              :       else
    2058            0 :         fputs (" ORDERED", dumpfile);
    2059              :     }
    2060            0 :   if (omp_clauses->untied)
    2061            0 :     fputs (" UNTIED", dumpfile);
    2062            0 :   if (omp_clauses->mergeable)
    2063            0 :     fputs (" MERGEABLE", dumpfile);
    2064            0 :   if (omp_clauses->nowait)
    2065            0 :     fputs (" NOWAIT", dumpfile);
    2066            0 :   if (omp_clauses->collapse)
    2067            0 :     fprintf (dumpfile, " COLLAPSE(%d)", omp_clauses->collapse);
    2068            0 :   if (omp_clauses->device_type != OMP_DEVICE_TYPE_UNSET)
    2069              :     {
    2070            0 :       const char *s;
    2071            0 :       switch (omp_clauses->device_type)
    2072              :         {
    2073              :         case OMP_DEVICE_TYPE_HOST: s = "host"; break;
    2074            0 :         case OMP_DEVICE_TYPE_NOHOST: s = "nohost"; break;
    2075            0 :         case OMP_DEVICE_TYPE_ANY: s = "any"; break;
    2076            0 :         case OMP_DEVICE_TYPE_UNSET:
    2077            0 :         default:
    2078            0 :           gcc_unreachable ();
    2079              :         }
    2080            0 :       fputs (" DEVICE_TYPE(", dumpfile);
    2081            0 :       fputs (s, dumpfile);
    2082            0 :       fputc (')', dumpfile);
    2083              :     }
    2084            0 :   for (list_type = 0; list_type < OMP_LIST_NUM; list_type++)
    2085            0 :     if (omp_clauses->lists[list_type] != NULL)
    2086              :       {
    2087            0 :         const char *type = NULL;
    2088            0 :         switch (list_type)
    2089              :           {
    2090              :           case OMP_LIST_PRIVATE: type = "PRIVATE"; break;
    2091            0 :           case OMP_LIST_FIRSTPRIVATE: type = "FIRSTPRIVATE"; break;
    2092            0 :           case OMP_LIST_LASTPRIVATE: type = "LASTPRIVATE"; break;
    2093            0 :           case OMP_LIST_COPYPRIVATE: type = "COPYPRIVATE"; break;
    2094            0 :           case OMP_LIST_SHARED: type = "SHARED"; break;
    2095            0 :           case OMP_LIST_COPYIN: type = "COPYIN"; break;
    2096            0 :           case OMP_LIST_UNIFORM: type = "UNIFORM"; break;
    2097            0 :           case OMP_LIST_AFFINITY: type = "AFFINITY"; break;
    2098            0 :           case OMP_LIST_ALIGNED: type = "ALIGNED"; break;
    2099            0 :           case OMP_LIST_LINEAR: type = "LINEAR"; break;
    2100            0 :           case OMP_LIST_DEPEND:
    2101            0 :             if (omp_clauses->lists[list_type]
    2102            0 :                 && (omp_clauses->lists[list_type]->u.depend_doacross_op
    2103              :                     == OMP_DOACROSS_SINK_FIRST))
    2104              :               type = "DOACROSS";
    2105              :             else
    2106            0 :               type = "DEPEND";
    2107              :             break;
    2108            0 :           case OMP_LIST_MAP: type = "MAP"; break;
    2109            0 :           case OMP_LIST_TO: type = "TO"; break;
    2110            0 :           case OMP_LIST_FROM: type = "FROM"; break;
    2111            0 :           case OMP_LIST_REDUCTION:
    2112            0 :           case OMP_LIST_REDUCTION_INSCAN:
    2113            0 :           case OMP_LIST_REDUCTION_TASK: type = "REDUCTION"; break;
    2114            0 :           case OMP_LIST_IN_REDUCTION: type = "IN_REDUCTION"; break;
    2115            0 :           case OMP_LIST_TASK_REDUCTION: type = "TASK_REDUCTION"; break;
    2116            0 :           case OMP_LIST_DEVICE_RESIDENT: type = "DEVICE_RESIDENT"; break;
    2117            0 :           case OMP_LIST_ENTER: type = "ENTER"; break;
    2118            0 :           case OMP_LIST_LINK: type = "LINK"; break;
    2119            0 :           case OMP_LIST_USE_DEVICE: type = "USE_DEVICE"; break;
    2120            0 :           case OMP_LIST_CACHE: type = "CACHE"; break;
    2121            0 :           case OMP_LIST_IS_DEVICE_PTR: type = "IS_DEVICE_PTR"; break;
    2122            0 :           case OMP_LIST_USE_DEVICE_PTR: type = "USE_DEVICE_PTR"; break;
    2123            0 :           case OMP_LIST_HAS_DEVICE_ADDR: type = "HAS_DEVICE_ADDR"; break;
    2124            0 :           case OMP_LIST_USE_DEVICE_ADDR: type = "USE_DEVICE_ADDR"; break;
    2125            0 :           case OMP_LIST_NONTEMPORAL: type = "NONTEMPORAL"; break;
    2126            0 :           case OMP_LIST_ALLOCATE: type = "ALLOCATE"; break;
    2127            0 :           case OMP_LIST_SCAN_IN: type = "INCLUSIVE"; break;
    2128            0 :           case OMP_LIST_SCAN_EX: type = "EXCLUSIVE"; break;
    2129            0 :           case OMP_LIST_USES_ALLOCATORS: type = "USES_ALLOCATORS"; break;
    2130            0 :           case OMP_LIST_INIT: type = "INIT"; break;
    2131            0 :           case OMP_LIST_USE: type = "USE"; break;
    2132            0 :           case OMP_LIST_DESTROY: type = "DESTROY"; break;
    2133            0 :           default:
    2134            0 :             gcc_unreachable ();
    2135              :           }
    2136            0 :         fprintf (dumpfile, " %s(", type);
    2137            0 :         if (list_type == OMP_LIST_REDUCTION_INSCAN)
    2138            0 :           fputs ("inscan, ", dumpfile);
    2139            0 :         if (list_type == OMP_LIST_REDUCTION_TASK)
    2140            0 :           fputs ("task, ", dumpfile);
    2141            0 :         if ((list_type == OMP_LIST_TO || list_type == OMP_LIST_FROM)
    2142            0 :             && omp_clauses->lists[list_type]->u.present_modifier)
    2143            0 :           fputs ("present:", dumpfile);
    2144            0 :         show_omp_namelist (list_type, omp_clauses->lists[list_type]);
    2145            0 :         fputc (')', dumpfile);
    2146              :       }
    2147            0 :   if (omp_clauses->safelen_expr)
    2148              :     {
    2149            0 :       fputs (" SAFELEN(", dumpfile);
    2150            0 :       show_expr (omp_clauses->safelen_expr);
    2151            0 :       fputc (')', dumpfile);
    2152              :     }
    2153            0 :   if (omp_clauses->simdlen_expr)
    2154              :     {
    2155            0 :       fputs (" SIMDLEN(", dumpfile);
    2156            0 :       show_expr (omp_clauses->simdlen_expr);
    2157            0 :       fputc (')', dumpfile);
    2158              :     }
    2159            0 :   if (omp_clauses->inbranch)
    2160            0 :     fputs (" INBRANCH", dumpfile);
    2161            0 :   if (omp_clauses->notinbranch)
    2162            0 :     fputs (" NOTINBRANCH", dumpfile);
    2163            0 :   if (omp_clauses->proc_bind != OMP_PROC_BIND_UNKNOWN)
    2164              :     {
    2165            0 :       const char *type;
    2166            0 :       switch (omp_clauses->proc_bind)
    2167              :         {
    2168              :         case OMP_PROC_BIND_PRIMARY: type = "PRIMARY"; break;
    2169            0 :         case OMP_PROC_BIND_MASTER: type = "MASTER"; break;
    2170            0 :         case OMP_PROC_BIND_SPREAD: type = "SPREAD"; break;
    2171            0 :         case OMP_PROC_BIND_CLOSE: type = "CLOSE"; break;
    2172            0 :         default:
    2173            0 :           gcc_unreachable ();
    2174              :         }
    2175            0 :       fprintf (dumpfile, " PROC_BIND(%s)", type);
    2176              :     }
    2177            0 :   if (omp_clauses->bind != OMP_BIND_UNSET)
    2178              :     {
    2179            0 :       const char *type;
    2180            0 :       switch (omp_clauses->bind)
    2181              :         {
    2182              :         case OMP_BIND_TEAMS: type = "TEAMS"; break;
    2183            0 :         case OMP_BIND_PARALLEL: type = "PARALLEL"; break;
    2184            0 :         case OMP_BIND_THREAD: type = "THREAD"; break;
    2185            0 :         default:
    2186            0 :           gcc_unreachable ();
    2187              :         }
    2188            0 :       fprintf (dumpfile, " BIND(%s)", type);
    2189              :     }
    2190            0 :   if (omp_clauses->num_teams_upper)
    2191              :     {
    2192            0 :       fputs (" NUM_TEAMS(", dumpfile);
    2193            0 :       if (omp_clauses->num_teams_lower)
    2194              :         {
    2195            0 :           show_expr (omp_clauses->num_teams_lower);
    2196            0 :           fputc (':', dumpfile);
    2197              :         }
    2198            0 :       show_expr (omp_clauses->num_teams_upper);
    2199            0 :       fputc (')', dumpfile);
    2200              :     }
    2201            0 :   if (omp_clauses->device)
    2202              :     {
    2203            0 :       fputs (" DEVICE(", dumpfile);
    2204            0 :       if (omp_clauses->ancestor)
    2205            0 :         fputs ("ANCESTOR:", dumpfile);
    2206            0 :       show_expr (omp_clauses->device);
    2207            0 :       fputc (')', dumpfile);
    2208              :     }
    2209            0 :   if (omp_clauses->thread_limit)
    2210              :     {
    2211            0 :       fputs (" THREAD_LIMIT(", dumpfile);
    2212            0 :       show_expr (omp_clauses->thread_limit);
    2213            0 :       fputc (')', dumpfile);
    2214              :     }
    2215            0 :   if (omp_clauses->dist_sched_kind != OMP_SCHED_NONE)
    2216              :     {
    2217            0 :       fputs (" DIST_SCHEDULE (STATIC", dumpfile);
    2218            0 :       if (omp_clauses->dist_chunk_size)
    2219              :         {
    2220            0 :           fputc (',', dumpfile);
    2221            0 :           show_expr (omp_clauses->dist_chunk_size);
    2222              :         }
    2223            0 :       fputc (')', dumpfile);
    2224              :     }
    2225            0 :   for (int i = 0; i < OMP_DEFAULTMAP_CAT_NUM; i++)
    2226              :     {
    2227            0 :       const char *dfltmap;
    2228            0 :       if (omp_clauses->defaultmap[i] == OMP_DEFAULTMAP_UNSET)
    2229            0 :         continue;
    2230            0 :       fputs (" DEFAULTMAP (", dumpfile);
    2231            0 :       switch (omp_clauses->defaultmap[i])
    2232              :         {
    2233              :         case OMP_DEFAULTMAP_ALLOC: dfltmap = "ALLOC"; break;
    2234            0 :         case OMP_DEFAULTMAP_TO: dfltmap = "TO"; break;
    2235            0 :         case OMP_DEFAULTMAP_FROM: dfltmap = "FROM"; break;
    2236            0 :         case OMP_DEFAULTMAP_TOFROM: dfltmap = "TOFROM"; break;
    2237            0 :         case OMP_DEFAULTMAP_FIRSTPRIVATE: dfltmap = "FIRSTPRIVATE"; break;
    2238            0 :         case OMP_DEFAULTMAP_NONE: dfltmap = "NONE"; break;
    2239            0 :         case OMP_DEFAULTMAP_DEFAULT: dfltmap = "DEFAULT"; break;
    2240            0 :         case OMP_DEFAULTMAP_PRESENT: dfltmap = "PRESENT"; break;
    2241            0 :         default: gcc_unreachable ();
    2242              :         }
    2243            0 :       fputs (dfltmap, dumpfile);
    2244            0 :       if (i != OMP_DEFAULTMAP_CAT_UNCATEGORIZED)
    2245              :         {
    2246            0 :           fputc (':', dumpfile);
    2247            0 :           switch ((enum gfc_omp_defaultmap_category) i)
    2248              :             {
    2249              :             case OMP_DEFAULTMAP_CAT_SCALAR: dfltmap = "SCALAR"; break;
    2250            0 :             case OMP_DEFAULTMAP_CAT_AGGREGATE: dfltmap = "AGGREGATE"; break;
    2251            0 :             case OMP_DEFAULTMAP_CAT_ALLOCATABLE: dfltmap = "ALLOCATABLE"; break;
    2252            0 :             case OMP_DEFAULTMAP_CAT_POINTER: dfltmap = "POINTER"; break;
    2253            0 :             default: gcc_unreachable ();
    2254              :             }
    2255            0 :           fputs (dfltmap, dumpfile);
    2256              :         }
    2257            0 :       fputc (')', dumpfile);
    2258              :     }
    2259            0 :   if (omp_clauses->weak)
    2260            0 :     fputs (" WEAK", dumpfile);
    2261            0 :   if (omp_clauses->compare)
    2262            0 :     fputs (" COMPARE", dumpfile);
    2263            0 :   if (omp_clauses->nogroup)
    2264            0 :     fputs (" NOGROUP", dumpfile);
    2265            0 :   if (omp_clauses->simd)
    2266            0 :     fputs (" SIMD", dumpfile);
    2267            0 :   if (omp_clauses->threads)
    2268            0 :     fputs (" THREADS", dumpfile);
    2269            0 :   if (omp_clauses->grainsize)
    2270              :     {
    2271            0 :       fputs (" GRAINSIZE(", dumpfile);
    2272            0 :       if (omp_clauses->grainsize_strict)
    2273            0 :         fputs ("strict: ", dumpfile);
    2274            0 :       show_expr (omp_clauses->grainsize);
    2275            0 :       fputc (')', dumpfile);
    2276              :     }
    2277            0 :   if (omp_clauses->filter)
    2278              :     {
    2279            0 :       fputs (" FILTER(", dumpfile);
    2280            0 :       show_expr (omp_clauses->filter);
    2281            0 :       fputc (')', dumpfile);
    2282              :     }
    2283            0 :   if (omp_clauses->hint)
    2284              :     {
    2285            0 :       fputs (" HINT(", dumpfile);
    2286            0 :       show_expr (omp_clauses->hint);
    2287            0 :       fputc (')', dumpfile);
    2288              :     }
    2289            0 :   if (omp_clauses->num_tasks)
    2290              :     {
    2291            0 :       fputs (" NUM_TASKS(", dumpfile);
    2292            0 :       if (omp_clauses->num_tasks_strict)
    2293            0 :         fputs ("strict: ", dumpfile);
    2294            0 :       show_expr (omp_clauses->num_tasks);
    2295            0 :       fputc (')', dumpfile);
    2296              :     }
    2297            0 :   if (omp_clauses->priority)
    2298              :     {
    2299            0 :       fputs (" PRIORITY(", dumpfile);
    2300            0 :       show_expr (omp_clauses->priority);
    2301            0 :       fputc (')', dumpfile);
    2302              :     }
    2303            0 :   if (omp_clauses->detach)
    2304              :     {
    2305            0 :       fputs (" DETACH(", dumpfile);
    2306            0 :       show_expr (omp_clauses->detach);
    2307            0 :       fputc (')', dumpfile);
    2308              :     }
    2309            0 :   if (omp_clauses->destroy)
    2310            0 :     fputs (" DESTROY", dumpfile);
    2311            0 :   if (omp_clauses->depend_source)
    2312            0 :     fputs (" DEPEND(source)", dumpfile);
    2313            0 :   if (omp_clauses->doacross_source)
    2314            0 :     fputs (" DOACROSS(source:)", dumpfile);
    2315            0 :   if (omp_clauses->dyn_groupprivate)
    2316              :     {
    2317            0 :       fputs (" DYN_GROUPPRIVATE(", dumpfile);
    2318            0 :       if (omp_clauses->fallback != OMP_FALLBACK_NONE)
    2319            0 :         fputs ("FALLBACK(", dumpfile);
    2320            0 :       if (omp_clauses->fallback == OMP_FALLBACK_ABORT)
    2321            0 :         fputs ("ABORT):", dumpfile);
    2322            0 :       else if (omp_clauses->fallback == OMP_FALLBACK_DEFAULT_MEM)
    2323            0 :         fputs ("DEFAULT_MEM):", dumpfile);
    2324            0 :       else if (omp_clauses->fallback == OMP_FALLBACK_NULL)
    2325            0 :         fputs ("NULL):", dumpfile);
    2326            0 :       show_expr (omp_clauses->dyn_groupprivate);
    2327            0 :       fputc (')', dumpfile);
    2328              :     }
    2329            0 :   if (omp_clauses->capture)
    2330            0 :     fputs (" CAPTURE", dumpfile);
    2331            0 :   if (omp_clauses->depobj_update != OMP_DEPEND_UNSET)
    2332              :     {
    2333            0 :       const char *deptype;
    2334            0 :       fputs (" UPDATE(", dumpfile);
    2335            0 :       switch (omp_clauses->depobj_update)
    2336              :         {
    2337              :         case OMP_DEPEND_IN: deptype = "IN"; break;
    2338            0 :         case OMP_DEPEND_OUT: deptype = "OUT"; break;
    2339            0 :         case OMP_DEPEND_INOUT: deptype = "INOUT"; break;
    2340            0 :         case OMP_DEPEND_INOUTSET: deptype = "INOUTSET"; break;
    2341            0 :         case OMP_DEPEND_MUTEXINOUTSET: deptype = "MUTEXINOUTSET"; break;
    2342            0 :         default: gcc_unreachable ();
    2343              :         }
    2344            0 :       fputs (deptype, dumpfile);
    2345            0 :       fputc (')', dumpfile);
    2346              :     }
    2347            0 :   if (omp_clauses->atomic_op != GFC_OMP_ATOMIC_UNSET)
    2348              :     {
    2349            0 :       const char *atomic_op;
    2350            0 :       switch (omp_clauses->atomic_op & GFC_OMP_ATOMIC_MASK)
    2351              :         {
    2352              :         case GFC_OMP_ATOMIC_READ: atomic_op = "READ"; break;
    2353            0 :         case GFC_OMP_ATOMIC_WRITE: atomic_op = "WRITE"; break;
    2354            0 :         case GFC_OMP_ATOMIC_UPDATE: atomic_op = "UPDATE"; break;
    2355            0 :         default: gcc_unreachable ();
    2356              :         }
    2357            0 :       fputc (' ', dumpfile);
    2358            0 :       fputs (atomic_op, dumpfile);
    2359              :     }
    2360            0 :   if (omp_clauses->memorder != OMP_MEMORDER_UNSET)
    2361              :     {
    2362            0 :       const char *memorder;
    2363            0 :       switch (omp_clauses->memorder)
    2364              :         {
    2365              :         case OMP_MEMORDER_ACQ_REL: memorder = "ACQ_REL"; break;
    2366            0 :         case OMP_MEMORDER_ACQUIRE: memorder = "AQUIRE"; break;
    2367            0 :         case OMP_MEMORDER_RELAXED: memorder = "RELAXED"; break;
    2368            0 :         case OMP_MEMORDER_RELEASE: memorder = "RELEASE"; break;
    2369            0 :         case OMP_MEMORDER_SEQ_CST: memorder = "SEQ_CST"; break;
    2370            0 :         default: gcc_unreachable ();
    2371              :         }
    2372            0 :       fputc (' ', dumpfile);
    2373            0 :       fputs (memorder, dumpfile);
    2374              :     }
    2375            0 :   if (omp_clauses->fail != OMP_MEMORDER_UNSET)
    2376              :     {
    2377            0 :       const char *memorder;
    2378            0 :       switch (omp_clauses->fail)
    2379              :         {
    2380              :         case OMP_MEMORDER_ACQUIRE: memorder = "AQUIRE"; break;
    2381            0 :         case OMP_MEMORDER_RELAXED: memorder = "RELAXED"; break;
    2382            0 :         case OMP_MEMORDER_SEQ_CST: memorder = "SEQ_CST"; break;
    2383            0 :         default: gcc_unreachable ();
    2384              :         }
    2385            0 :       fputs (" FAIL(", dumpfile);
    2386            0 :       fputs (memorder, dumpfile);
    2387            0 :       putc (')', dumpfile);
    2388              :     }
    2389            0 :   if (omp_clauses->at != OMP_AT_UNSET)
    2390              :     {
    2391            0 :       if (omp_clauses->at != OMP_AT_COMPILATION)
    2392            0 :         fputs (" AT (COMPILATION)", dumpfile);
    2393              :       else
    2394            0 :         fputs (" AT (EXECUTION)", dumpfile);
    2395              :     }
    2396            0 :   if (omp_clauses->severity != OMP_SEVERITY_UNSET)
    2397              :     {
    2398            0 :       if (omp_clauses->severity != OMP_SEVERITY_FATAL)
    2399            0 :         fputs (" SEVERITY (FATAL)", dumpfile);
    2400              :       else
    2401            0 :         fputs (" SEVERITY (WARNING)", dumpfile);
    2402              :     }
    2403            0 :   if (omp_clauses->message)
    2404              :     {
    2405            0 :       fputs (" ERROR (", dumpfile);
    2406            0 :       show_expr (omp_clauses->message);
    2407            0 :       fputc (')', dumpfile);
    2408              :     }
    2409            0 :   if (omp_clauses->assume)
    2410            0 :     show_omp_assumes (omp_clauses->assume);
    2411            0 :   if (omp_clauses->full)
    2412            0 :     fputs (" FULL", dumpfile);
    2413            0 :   if (omp_clauses->partial)
    2414              :     {
    2415            0 :       fputs (" PARTIAL", dumpfile);
    2416            0 :       if (omp_clauses->partial > 0)
    2417            0 :         fprintf (dumpfile, "(%d)", omp_clauses->partial);
    2418              :     }
    2419            0 :   if (omp_clauses->sizes_list)
    2420              :     {
    2421            0 :       gfc_expr_list *sizes;
    2422            0 :       fputs (" SIZES(", dumpfile);
    2423            0 :       for (sizes = omp_clauses->sizes_list; sizes; sizes = sizes->next)
    2424              :         {
    2425            0 :           show_expr (sizes->expr);
    2426            0 :           if (sizes->next)
    2427            0 :             fputs (", ", dumpfile);
    2428              :         }
    2429            0 :       fputc (')', dumpfile);
    2430              :     }
    2431            0 :   if (omp_clauses->novariants)
    2432              :     {
    2433            0 :       fputs (" NOVARIANTS(", dumpfile);
    2434            0 :       show_expr (omp_clauses->novariants);
    2435            0 :       fputc (')', dumpfile);
    2436              :     }
    2437            0 :   if (omp_clauses->nocontext)
    2438              :     {
    2439            0 :       fputs (" NOCONTEXT(", dumpfile);
    2440            0 :       show_expr (omp_clauses->nocontext);
    2441            0 :       fputc (')', dumpfile);
    2442              :     }
    2443            0 : }
    2444              : 
    2445              : /* Show a single OpenMP or OpenACC directive node and everything underneath it
    2446              :    if necessary.  */
    2447              : 
    2448              : static void
    2449            0 : show_omp_node (int level, gfc_code *c)
    2450              : {
    2451            0 :   gfc_omp_clauses *omp_clauses = NULL;
    2452            0 :   const char *name = NULL;
    2453            0 :   bool is_oacc = false;
    2454              : 
    2455            0 :   switch (c->op)
    2456              :     {
    2457              :     case EXEC_OACC_PARALLEL_LOOP:
    2458              :       name = "PARALLEL LOOP"; is_oacc = true; break;
    2459            0 :     case EXEC_OACC_PARALLEL: name = "PARALLEL"; is_oacc = true; break;
    2460            0 :     case EXEC_OACC_KERNELS_LOOP: name = "KERNELS LOOP"; is_oacc = true; break;
    2461            0 :     case EXEC_OACC_KERNELS: name = "KERNELS"; is_oacc = true; break;
    2462            0 :     case EXEC_OACC_SERIAL_LOOP: name = "SERIAL LOOP"; is_oacc = true; break;
    2463            0 :     case EXEC_OACC_SERIAL: name = "SERIAL"; is_oacc = true; break;
    2464            0 :     case EXEC_OACC_DATA: name = "DATA"; is_oacc = true; break;
    2465            0 :     case EXEC_OACC_HOST_DATA: name = "HOST_DATA"; is_oacc = true; break;
    2466            0 :     case EXEC_OACC_LOOP: name = "LOOP"; is_oacc = true; break;
    2467            0 :     case EXEC_OACC_UPDATE: name = "UPDATE"; is_oacc = true; break;
    2468            0 :     case EXEC_OACC_WAIT: name = "WAIT"; is_oacc = true; break;
    2469            0 :     case EXEC_OACC_CACHE: name = "CACHE"; is_oacc = true; break;
    2470            0 :     case EXEC_OACC_ENTER_DATA: name = "ENTER DATA"; is_oacc = true; break;
    2471            0 :     case EXEC_OACC_EXIT_DATA: name = "EXIT DATA"; is_oacc = true; break;
    2472            0 :     case EXEC_OMP_ALLOCATE: name = "ALLOCATE"; break;
    2473            0 :     case EXEC_OMP_ALLOCATORS: name = "ALLOCATORS"; break;
    2474            0 :     case EXEC_OMP_ASSUME: name = "ASSUME"; break;
    2475            0 :     case EXEC_OMP_ATOMIC: name = "ATOMIC"; break;
    2476            0 :     case EXEC_OMP_BARRIER: name = "BARRIER"; break;
    2477            0 :     case EXEC_OMP_CANCEL: name = "CANCEL"; break;
    2478            0 :     case EXEC_OMP_CANCELLATION_POINT: name = "CANCELLATION POINT"; break;
    2479            0 :     case EXEC_OMP_CRITICAL: name = "CRITICAL"; break;
    2480            0 :     case EXEC_OMP_DISPATCH:
    2481            0 :       name = "DISPATCH";
    2482            0 :       break;
    2483            0 :     case EXEC_OMP_DISTRIBUTE: name = "DISTRIBUTE"; break;
    2484            0 :     case EXEC_OMP_DISTRIBUTE_PARALLEL_DO:
    2485            0 :       name = "DISTRIBUTE PARALLEL DO"; break;
    2486            0 :     case EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD:
    2487            0 :       name = "DISTRIBUTE PARALLEL DO SIMD"; break;
    2488            0 :     case EXEC_OMP_DISTRIBUTE_SIMD: name = "DISTRIBUTE SIMD"; break;
    2489            0 :     case EXEC_OMP_DO: name = "DO"; break;
    2490            0 :     case EXEC_OMP_DO_SIMD: name = "DO SIMD"; break;
    2491            0 :     case EXEC_OMP_ERROR: name = "ERROR"; break;
    2492            0 :     case EXEC_OMP_FLUSH: name = "FLUSH"; break;
    2493            0 :     case EXEC_OMP_INTEROP: name = "INTEROP"; break;
    2494            0 :     case EXEC_OMP_LOOP: name = "LOOP"; break;
    2495            0 :     case EXEC_OMP_MASKED: name = "MASKED"; break;
    2496            0 :     case EXEC_OMP_MASKED_TASKLOOP: name = "MASKED TASKLOOP"; break;
    2497            0 :     case EXEC_OMP_MASKED_TASKLOOP_SIMD: name = "MASKED TASKLOOP SIMD"; break;
    2498            0 :     case EXEC_OMP_MASTER: name = "MASTER"; break;
    2499            0 :     case EXEC_OMP_MASTER_TASKLOOP: name = "MASTER TASKLOOP"; break;
    2500            0 :     case EXEC_OMP_MASTER_TASKLOOP_SIMD: name = "MASTER TASKLOOP SIMD"; break;
    2501            0 :     case EXEC_OMP_METADIRECTIVE: name = "METADIRECTIVE"; break;
    2502            0 :     case EXEC_OMP_ORDERED: name = "ORDERED"; break;
    2503            0 :     case EXEC_OMP_DEPOBJ: name = "DEPOBJ"; break;
    2504            0 :     case EXEC_OMP_PARALLEL: name = "PARALLEL"; break;
    2505            0 :     case EXEC_OMP_PARALLEL_DO: name = "PARALLEL DO"; break;
    2506            0 :     case EXEC_OMP_PARALLEL_DO_SIMD: name = "PARALLEL DO SIMD"; break;
    2507            0 :     case EXEC_OMP_PARALLEL_LOOP: name = "PARALLEL LOOP"; break;
    2508            0 :     case EXEC_OMP_PARALLEL_MASTER: name = "PARALLEL MASTER"; break;
    2509            0 :     case EXEC_OMP_PARALLEL_MASKED: name = "PARALLEL MASK"; break;
    2510            0 :     case EXEC_OMP_PARALLEL_MASKED_TASKLOOP:
    2511            0 :       name = "PARALLEL MASK TASKLOOP"; break;
    2512            0 :     case EXEC_OMP_PARALLEL_MASKED_TASKLOOP_SIMD:
    2513            0 :       name = "PARALLEL MASK TASKLOOP SIMD"; break;
    2514            0 :     case EXEC_OMP_PARALLEL_MASTER_TASKLOOP:
    2515            0 :       name = "PARALLEL MASTER TASKLOOP"; break;
    2516            0 :     case EXEC_OMP_PARALLEL_MASTER_TASKLOOP_SIMD:
    2517            0 :       name = "PARALLEL MASTER TASKLOOP SIMD"; break;
    2518            0 :     case EXEC_OMP_PARALLEL_SECTIONS: name = "PARALLEL SECTIONS"; break;
    2519            0 :     case EXEC_OMP_PARALLEL_WORKSHARE: name = "PARALLEL WORKSHARE"; break;
    2520            0 :     case EXEC_OMP_SCAN: name = "SCAN"; break;
    2521            0 :     case EXEC_OMP_SCOPE: name = "SCOPE"; break;
    2522            0 :     case EXEC_OMP_SECTIONS: name = "SECTIONS"; break;
    2523            0 :     case EXEC_OMP_SIMD: name = "SIMD"; break;
    2524            0 :     case EXEC_OMP_SINGLE: name = "SINGLE"; break;
    2525            0 :     case EXEC_OMP_TARGET: name = "TARGET"; break;
    2526            0 :     case EXEC_OMP_TARGET_DATA: name = "TARGET DATA"; break;
    2527            0 :     case EXEC_OMP_TARGET_ENTER_DATA: name = "TARGET ENTER DATA"; break;
    2528            0 :     case EXEC_OMP_TARGET_EXIT_DATA: name = "TARGET EXIT DATA"; break;
    2529            0 :     case EXEC_OMP_TARGET_PARALLEL: name = "TARGET PARALLEL"; break;
    2530            0 :     case EXEC_OMP_TARGET_PARALLEL_DO: name = "TARGET PARALLEL DO"; break;
    2531            0 :     case EXEC_OMP_TARGET_PARALLEL_DO_SIMD:
    2532            0 :       name = "TARGET_PARALLEL_DO_SIMD"; break;
    2533            0 :     case EXEC_OMP_TARGET_PARALLEL_LOOP: name = "TARGET PARALLEL LOOP"; break;
    2534            0 :     case EXEC_OMP_TARGET_SIMD: name = "TARGET SIMD"; break;
    2535            0 :     case EXEC_OMP_TARGET_TEAMS: name = "TARGET TEAMS"; break;
    2536            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE:
    2537            0 :       name = "TARGET TEAMS DISTRIBUTE"; break;
    2538            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO:
    2539            0 :       name = "TARGET TEAMS DISTRIBUTE PARALLEL DO"; break;
    2540            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
    2541            0 :       name = "TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD"; break;
    2542            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD:
    2543            0 :       name = "TARGET TEAMS DISTRIBUTE SIMD"; break;
    2544            0 :     case EXEC_OMP_TARGET_TEAMS_LOOP: name = "TARGET TEAMS LOOP"; break;
    2545            0 :     case EXEC_OMP_TARGET_UPDATE: name = "TARGET UPDATE"; break;
    2546            0 :     case EXEC_OMP_TASK: name = "TASK"; break;
    2547            0 :     case EXEC_OMP_TASKGROUP: name = "TASKGROUP"; break;
    2548            0 :     case EXEC_OMP_TASKLOOP: name = "TASKLOOP"; break;
    2549            0 :     case EXEC_OMP_TASKLOOP_SIMD: name = "TASKLOOP SIMD"; break;
    2550            0 :     case EXEC_OMP_TASKWAIT: name = "TASKWAIT"; break;
    2551            0 :     case EXEC_OMP_TASKYIELD: name = "TASKYIELD"; break;
    2552            0 :     case EXEC_OMP_TEAMS: name = "TEAMS"; break;
    2553            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE: name = "TEAMS DISTRIBUTE"; break;
    2554            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO:
    2555            0 :       name = "TEAMS DISTRIBUTE PARALLEL DO"; break;
    2556            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
    2557            0 :       name = "TEAMS DISTRIBUTE PARALLEL DO SIMD"; break;
    2558            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_SIMD: name = "TEAMS DISTRIBUTE SIMD"; break;
    2559            0 :     case EXEC_OMP_TEAMS_LOOP: name = "TEAMS LOOP"; break;
    2560            0 :     case EXEC_OMP_TILE: name = "TILE"; break;
    2561            0 :     case EXEC_OMP_UNROLL: name = "UNROLL"; break;
    2562            0 :     case EXEC_OMP_WORKSHARE: name = "WORKSHARE"; break;
    2563            0 :     default:
    2564            0 :       gcc_unreachable ();
    2565              :     }
    2566            0 :   fprintf (dumpfile, "!$%s %s", is_oacc ? "ACC" : "OMP", name);
    2567            0 :   switch (c->op)
    2568              :     {
    2569            0 :     case EXEC_OACC_PARALLEL_LOOP:
    2570            0 :     case EXEC_OACC_PARALLEL:
    2571            0 :     case EXEC_OACC_KERNELS_LOOP:
    2572            0 :     case EXEC_OACC_KERNELS:
    2573            0 :     case EXEC_OACC_SERIAL_LOOP:
    2574            0 :     case EXEC_OACC_SERIAL:
    2575            0 :     case EXEC_OACC_DATA:
    2576            0 :     case EXEC_OACC_HOST_DATA:
    2577            0 :     case EXEC_OACC_LOOP:
    2578            0 :     case EXEC_OACC_UPDATE:
    2579            0 :     case EXEC_OACC_WAIT:
    2580            0 :     case EXEC_OACC_CACHE:
    2581            0 :     case EXEC_OACC_ENTER_DATA:
    2582            0 :     case EXEC_OACC_EXIT_DATA:
    2583            0 :     case EXEC_OMP_ALLOCATE:
    2584            0 :     case EXEC_OMP_ALLOCATORS:
    2585            0 :     case EXEC_OMP_ASSUME:
    2586            0 :     case EXEC_OMP_CANCEL:
    2587            0 :     case EXEC_OMP_CANCELLATION_POINT:
    2588            0 :     case EXEC_OMP_DISPATCH:
    2589            0 :     case EXEC_OMP_DISTRIBUTE:
    2590            0 :     case EXEC_OMP_DISTRIBUTE_PARALLEL_DO:
    2591            0 :     case EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD:
    2592            0 :     case EXEC_OMP_DISTRIBUTE_SIMD:
    2593            0 :     case EXEC_OMP_DO:
    2594            0 :     case EXEC_OMP_DO_SIMD:
    2595            0 :     case EXEC_OMP_ERROR:
    2596            0 :     case EXEC_OMP_INTEROP:
    2597            0 :     case EXEC_OMP_LOOP:
    2598            0 :     case EXEC_OMP_ORDERED:
    2599            0 :     case EXEC_OMP_MASKED:
    2600            0 :     case EXEC_OMP_PARALLEL:
    2601            0 :     case EXEC_OMP_PARALLEL_DO:
    2602            0 :     case EXEC_OMP_PARALLEL_DO_SIMD:
    2603            0 :     case EXEC_OMP_PARALLEL_LOOP:
    2604            0 :     case EXEC_OMP_PARALLEL_MASKED:
    2605            0 :     case EXEC_OMP_PARALLEL_MASKED_TASKLOOP:
    2606            0 :     case EXEC_OMP_PARALLEL_MASKED_TASKLOOP_SIMD:
    2607            0 :     case EXEC_OMP_PARALLEL_MASTER:
    2608            0 :     case EXEC_OMP_PARALLEL_MASTER_TASKLOOP:
    2609            0 :     case EXEC_OMP_PARALLEL_MASTER_TASKLOOP_SIMD:
    2610            0 :     case EXEC_OMP_PARALLEL_SECTIONS:
    2611            0 :     case EXEC_OMP_PARALLEL_WORKSHARE:
    2612            0 :     case EXEC_OMP_SCAN:
    2613            0 :     case EXEC_OMP_SCOPE:
    2614            0 :     case EXEC_OMP_SECTIONS:
    2615            0 :     case EXEC_OMP_SIMD:
    2616            0 :     case EXEC_OMP_SINGLE:
    2617            0 :     case EXEC_OMP_TARGET:
    2618            0 :     case EXEC_OMP_TARGET_DATA:
    2619            0 :     case EXEC_OMP_TARGET_ENTER_DATA:
    2620            0 :     case EXEC_OMP_TARGET_EXIT_DATA:
    2621            0 :     case EXEC_OMP_TARGET_PARALLEL:
    2622            0 :     case EXEC_OMP_TARGET_PARALLEL_DO:
    2623            0 :     case EXEC_OMP_TARGET_PARALLEL_DO_SIMD:
    2624            0 :     case EXEC_OMP_TARGET_PARALLEL_LOOP:
    2625            0 :     case EXEC_OMP_TARGET_SIMD:
    2626            0 :     case EXEC_OMP_TARGET_TEAMS:
    2627            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE:
    2628            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO:
    2629            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
    2630            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD:
    2631            0 :     case EXEC_OMP_TARGET_TEAMS_LOOP:
    2632            0 :     case EXEC_OMP_TARGET_UPDATE:
    2633            0 :     case EXEC_OMP_TASK:
    2634            0 :     case EXEC_OMP_TASKLOOP:
    2635            0 :     case EXEC_OMP_TASKLOOP_SIMD:
    2636            0 :     case EXEC_OMP_TEAMS:
    2637            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE:
    2638            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO:
    2639            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
    2640            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_SIMD:
    2641            0 :     case EXEC_OMP_TEAMS_LOOP:
    2642            0 :     case EXEC_OMP_TILE:
    2643            0 :     case EXEC_OMP_UNROLL:
    2644            0 :     case EXEC_OMP_WORKSHARE:
    2645            0 :       omp_clauses = c->ext.omp_clauses;
    2646            0 :       break;
    2647            0 :     case EXEC_OMP_CRITICAL:
    2648            0 :       omp_clauses = c->ext.omp_clauses;
    2649            0 :       if (omp_clauses)
    2650            0 :         fprintf (dumpfile, " (%s)", c->ext.omp_clauses->critical_name);
    2651              :       break;
    2652            0 :     case EXEC_OMP_DEPOBJ:
    2653            0 :       omp_clauses = c->ext.omp_clauses;
    2654            0 :       if (omp_clauses)
    2655              :         {
    2656            0 :           fputc ('(', dumpfile);
    2657            0 :           show_expr (c->ext.omp_clauses->depobj);
    2658            0 :           fputc (')', dumpfile);
    2659              :         }
    2660              :       break;
    2661            0 :     case EXEC_OMP_FLUSH:
    2662            0 :       if (c->ext.omp_namelist)
    2663              :         {
    2664            0 :           fputs (" (", dumpfile);
    2665            0 :           show_omp_namelist (OMP_LIST_NUM, c->ext.omp_namelist);
    2666            0 :           fputc (')', dumpfile);
    2667              :         }
    2668              :       return;
    2669              :     case EXEC_OMP_BARRIER:
    2670              :     case EXEC_OMP_TASKWAIT:
    2671              :     case EXEC_OMP_TASKYIELD:
    2672              :       return;
    2673            0 :     case EXEC_OACC_ATOMIC:
    2674            0 :     case EXEC_OMP_ATOMIC:
    2675            0 :       omp_clauses = c->block ? c->block->ext.omp_clauses : NULL;
    2676              :       break;
    2677              :     default:
    2678              :       break;
    2679              :     }
    2680            0 :   if (omp_clauses)
    2681            0 :     show_omp_clauses (omp_clauses);
    2682            0 :   fputc ('\n', dumpfile);
    2683              : 
    2684              :   /* OpenMP and OpenACC executable directives don't have associated blocks.  */
    2685            0 :   if (c->op == EXEC_OACC_CACHE || c->op == EXEC_OACC_UPDATE
    2686              :       || c->op == EXEC_OACC_ENTER_DATA || c->op == EXEC_OACC_EXIT_DATA
    2687              :       || c->op == EXEC_OMP_TARGET_UPDATE || c->op == EXEC_OMP_TARGET_ENTER_DATA
    2688              :       || c->op == EXEC_OMP_TARGET_EXIT_DATA || c->op == EXEC_OMP_SCAN
    2689              :       || c->op == EXEC_OMP_DEPOBJ || c->op == EXEC_OMP_ERROR
    2690              :       || c->op == EXEC_OMP_INTEROP
    2691            0 :       || (c->op == EXEC_OMP_ORDERED && c->block == NULL))
    2692              :     return;
    2693            0 :   if (c->op == EXEC_OMP_SECTIONS || c->op == EXEC_OMP_PARALLEL_SECTIONS)
    2694              :     {
    2695            0 :       gfc_code *d = c->block;
    2696            0 :       while (d != NULL)
    2697              :         {
    2698            0 :           show_code (level + 1, d->next);
    2699            0 :           if (d->block == NULL)
    2700              :             break;
    2701            0 :           code_indent (level, 0);
    2702            0 :           fputs ("!$OMP SECTION\n", dumpfile);
    2703            0 :           d = d->block;
    2704              :         }
    2705              :     }
    2706            0 :   else if (c->op == EXEC_OMP_METADIRECTIVE)
    2707              :     {
    2708            0 :       gfc_omp_variant *variant = c->ext.omp_variants;
    2709              : 
    2710            0 :       while (variant)
    2711              :         {
    2712            0 :           code_indent (level + 1, 0);
    2713            0 :           if (variant->selectors)
    2714            0 :             fputs ("WHEN ()\n", dumpfile);
    2715              :           else
    2716            0 :             fputs ("DEFAULT ()\n", dumpfile);
    2717              :           /* TODO: Print selector.  */
    2718            0 :           show_code (level + 2, variant->code);
    2719            0 :           if (variant->next)
    2720            0 :             fputs ("\n", dumpfile);
    2721            0 :           variant = variant->next;
    2722              :         }
    2723              :     }
    2724              :   else
    2725            0 :     show_code (level + 1, c->block->next);
    2726            0 :   if (c->op == EXEC_OMP_ATOMIC)
    2727              :     return;
    2728            0 :   fputc ('\n', dumpfile);
    2729            0 :   code_indent (level, 0);
    2730            0 :   fprintf (dumpfile, "!$%s END %s", is_oacc ? "ACC" : "OMP", name);
    2731            0 :   if (c->op == EXEC_OMP_CRITICAL && c->ext.omp_clauses)
    2732            0 :     fprintf (dumpfile, " (%s)", c->ext.omp_clauses->critical_name);
    2733              : }
    2734              : 
    2735              : static void
    2736            0 : show_sync_stat (struct sync_stat *sync_stat)
    2737              : {
    2738            0 :   if (sync_stat->stat)
    2739              :     {
    2740            0 :       fputs (" stat=", dumpfile);
    2741            0 :       show_expr (sync_stat->stat);
    2742              :     }
    2743            0 :   if (sync_stat->errmsg)
    2744              :     {
    2745            0 :       fputs (" errmsg=", dumpfile);
    2746            0 :       show_expr (sync_stat->errmsg);
    2747              :     }
    2748            0 : }
    2749              : 
    2750              : /* Show a single code node and everything underneath it if necessary.  */
    2751              : 
    2752              : static void
    2753          232 : show_code_node (int level, gfc_code *c)
    2754              : {
    2755          232 :   gfc_forall_iterator *fa;
    2756          232 :   gfc_open *open;
    2757          232 :   gfc_case *cp;
    2758          232 :   gfc_alloc *a;
    2759          232 :   gfc_code *d;
    2760          232 :   gfc_close *close;
    2761          232 :   gfc_filepos *fp;
    2762          232 :   gfc_inquire *i;
    2763          232 :   gfc_dt *dt;
    2764          232 :   gfc_namespace *ns;
    2765              : 
    2766          232 :   if (c->here)
    2767              :     {
    2768            0 :       fputc ('\n', dumpfile);
    2769            0 :       code_indent (level, c->here);
    2770              :     }
    2771              :   else
    2772          232 :     show_indent ();
    2773              : 
    2774          232 :   switch (c->op)
    2775              :     {
    2776              :     case EXEC_END_PROCEDURE:
    2777              :       break;
    2778              : 
    2779            0 :     case EXEC_NOP:
    2780            0 :       fputs ("NOP", dumpfile);
    2781            0 :       break;
    2782              : 
    2783            0 :     case EXEC_CONTINUE:
    2784            0 :       fputs ("CONTINUE", dumpfile);
    2785            0 :       break;
    2786              : 
    2787            0 :     case EXEC_ENTRY:
    2788            0 :       fprintf (dumpfile, "ENTRY %s", c->ext.entry->sym->name);
    2789            0 :       break;
    2790              : 
    2791            6 :     case EXEC_INIT_ASSIGN:
    2792            6 :     case EXEC_ASSIGN:
    2793            6 :       fputs ("ASSIGN ", dumpfile);
    2794            6 :       show_expr (c->expr1);
    2795            6 :       fputc (' ', dumpfile);
    2796            6 :       show_expr (c->expr2);
    2797            6 :       break;
    2798              : 
    2799            0 :     case EXEC_LABEL_ASSIGN:
    2800            0 :       fputs ("LABEL ASSIGN ", dumpfile);
    2801            0 :       show_expr (c->expr1);
    2802            0 :       fprintf (dumpfile, " %d", c->label1->value);
    2803            0 :       break;
    2804              : 
    2805            0 :     case EXEC_POINTER_ASSIGN:
    2806            0 :       fputs ("POINTER ASSIGN ", dumpfile);
    2807            0 :       show_expr (c->expr1);
    2808            0 :       fputc (' ', dumpfile);
    2809            0 :       show_expr (c->expr2);
    2810            0 :       break;
    2811              : 
    2812            0 :     case EXEC_GOTO:
    2813            0 :       fputs ("GOTO ", dumpfile);
    2814            0 :       if (c->label1)
    2815            0 :         fprintf (dumpfile, "%d", c->label1->value);
    2816              :       else
    2817              :         {
    2818            0 :           show_expr (c->expr1);
    2819            0 :           d = c->block;
    2820            0 :           if (d != NULL)
    2821              :             {
    2822            0 :               fputs (", (", dumpfile);
    2823            0 :               for (; d; d = d ->block)
    2824              :                 {
    2825            0 :                   code_indent (level, d->label1);
    2826            0 :                   if (d->block != NULL)
    2827            0 :                     fputc (',', dumpfile);
    2828              :                   else
    2829            0 :                     fputc (')', dumpfile);
    2830              :                 }
    2831              :             }
    2832              :         }
    2833              :       break;
    2834              : 
    2835            0 :     case EXEC_CALL:
    2836            0 :     case EXEC_ASSIGN_CALL:
    2837            0 :       if (c->resolved_sym)
    2838            0 :         fprintf (dumpfile, "CALL %s ", c->resolved_sym->name);
    2839            0 :       else if (c->symtree)
    2840            0 :         fprintf (dumpfile, "CALL %s ", c->symtree->name);
    2841              :       else
    2842            0 :         fputs ("CALL ?? ", dumpfile);
    2843              : 
    2844            0 :       show_actual_arglist (c->ext.actual);
    2845            0 :       break;
    2846              : 
    2847            0 :     case EXEC_COMPCALL:
    2848            0 :       fputs ("CALL ", dumpfile);
    2849            0 :       show_compcall (c->expr1);
    2850            0 :       break;
    2851              : 
    2852            0 :     case EXEC_CALL_PPC:
    2853            0 :       fputs ("CALL ", dumpfile);
    2854            0 :       show_expr (c->expr1);
    2855            0 :       show_actual_arglist (c->ext.actual);
    2856            0 :       break;
    2857              : 
    2858            0 :     case EXEC_RETURN:
    2859            0 :       fputs ("RETURN ", dumpfile);
    2860            0 :       if (c->expr1)
    2861            0 :         show_expr (c->expr1);
    2862              :       break;
    2863              : 
    2864            0 :     case EXEC_PAUSE:
    2865            0 :       fputs ("PAUSE ", dumpfile);
    2866              : 
    2867            0 :       if (c->expr1 != NULL)
    2868            0 :         show_expr (c->expr1);
    2869              :       else
    2870            0 :         fprintf (dumpfile, "%d", c->ext.stop_code);
    2871              : 
    2872              :       break;
    2873              : 
    2874            0 :     case EXEC_ERROR_STOP:
    2875            0 :       fputs ("ERROR ", dumpfile);
    2876              :       /* Fall through.  */
    2877              : 
    2878           24 :     case EXEC_STOP:
    2879           24 :       fputs ("STOP ", dumpfile);
    2880              : 
    2881           24 :       if (c->expr1 != NULL)
    2882           24 :         show_expr (c->expr1);
    2883              :       else
    2884            0 :         fprintf (dumpfile, "%d", c->ext.stop_code);
    2885           24 :       if (c->expr2 != NULL)
    2886              :         {
    2887            0 :           fputs (" QUIET=", dumpfile);
    2888            0 :           show_expr (c->expr2);
    2889              :         }
    2890              : 
    2891              :       break;
    2892              : 
    2893            0 :     case EXEC_FAIL_IMAGE:
    2894            0 :       fputs ("FAIL IMAGE ", dumpfile);
    2895            0 :       break;
    2896              : 
    2897            0 :     case EXEC_END_TEAM:
    2898            0 :       fputs ("END TEAM", dumpfile);
    2899            0 :       show_sync_stat (&c->ext.sync_stat);
    2900            0 :       break;
    2901              : 
    2902            0 :     case EXEC_FORM_TEAM:
    2903            0 :       fputs ("FORM TEAM ", dumpfile);
    2904            0 :       show_expr (c->expr1);
    2905            0 :       show_expr (c->expr2);
    2906            0 :       if (c->expr3)
    2907              :         {
    2908            0 :           fputs (" NEW_INDEX", dumpfile);
    2909            0 :           show_expr (c->expr3);
    2910              :         }
    2911            0 :       show_sync_stat (&c->ext.sync_stat);
    2912            0 :       break;
    2913              : 
    2914            0 :     case EXEC_SYNC_TEAM:
    2915            0 :       fputs ("SYNC TEAM ", dumpfile);
    2916            0 :       show_expr (c->expr1);
    2917            0 :       show_sync_stat (&c->ext.sync_stat);
    2918            0 :       break;
    2919              : 
    2920            0 :     case EXEC_SYNC_ALL:
    2921            0 :       fputs ("SYNC ALL ", dumpfile);
    2922            0 :       if (c->expr2 != NULL)
    2923              :         {
    2924            0 :           fputs (" stat=", dumpfile);
    2925            0 :           show_expr (c->expr2);
    2926              :         }
    2927            0 :       if (c->expr3 != NULL)
    2928              :         {
    2929            0 :           fputs (" errmsg=", dumpfile);
    2930            0 :           show_expr (c->expr3);
    2931              :         }
    2932              :       break;
    2933              : 
    2934            0 :     case EXEC_SYNC_MEMORY:
    2935            0 :       fputs ("SYNC MEMORY ", dumpfile);
    2936            0 :       if (c->expr2 != NULL)
    2937              :         {
    2938            0 :           fputs (" stat=", dumpfile);
    2939            0 :           show_expr (c->expr2);
    2940              :         }
    2941            0 :       if (c->expr3 != NULL)
    2942              :         {
    2943            0 :           fputs (" errmsg=", dumpfile);
    2944            0 :           show_expr (c->expr3);
    2945              :         }
    2946              :       break;
    2947              : 
    2948            0 :     case EXEC_SYNC_IMAGES:
    2949            0 :       fputs ("SYNC IMAGES  image-set=", dumpfile);
    2950            0 :       if (c->expr1 != NULL)
    2951            0 :         show_expr (c->expr1);
    2952              :       else
    2953            0 :         fputs ("* ", dumpfile);
    2954            0 :       if (c->expr2 != NULL)
    2955              :         {
    2956            0 :           fputs (" stat=", dumpfile);
    2957            0 :           show_expr (c->expr2);
    2958              :         }
    2959            0 :       if (c->expr3 != NULL)
    2960              :         {
    2961            0 :           fputs (" errmsg=", dumpfile);
    2962            0 :           show_expr (c->expr3);
    2963              :         }
    2964              :       break;
    2965              : 
    2966            0 :     case EXEC_EVENT_POST:
    2967            0 :     case EXEC_EVENT_WAIT:
    2968            0 :       if (c->op == EXEC_EVENT_POST)
    2969            0 :         fputs ("EVENT POST ", dumpfile);
    2970              :       else
    2971            0 :         fputs ("EVENT WAIT ", dumpfile);
    2972              : 
    2973            0 :       fputs ("event-variable=", dumpfile);
    2974            0 :       if (c->expr1 != NULL)
    2975            0 :         show_expr (c->expr1);
    2976            0 :       if (c->expr4 != NULL)
    2977              :         {
    2978            0 :           fputs (" until_count=", dumpfile);
    2979            0 :           show_expr (c->expr4);
    2980              :         }
    2981            0 :       if (c->expr2 != NULL)
    2982              :         {
    2983            0 :           fputs (" stat=", dumpfile);
    2984            0 :           show_expr (c->expr2);
    2985              :         }
    2986            0 :       if (c->expr3 != NULL)
    2987              :         {
    2988            0 :           fputs (" errmsg=", dumpfile);
    2989            0 :           show_expr (c->expr3);
    2990              :         }
    2991              :       break;
    2992              : 
    2993            0 :     case EXEC_LOCK:
    2994            0 :     case EXEC_UNLOCK:
    2995            0 :       if (c->op == EXEC_LOCK)
    2996            0 :         fputs ("LOCK ", dumpfile);
    2997              :       else
    2998            0 :         fputs ("UNLOCK ", dumpfile);
    2999              : 
    3000            0 :       fputs ("lock-variable=", dumpfile);
    3001            0 :       if (c->expr1 != NULL)
    3002            0 :         show_expr (c->expr1);
    3003            0 :       if (c->expr4 != NULL)
    3004              :         {
    3005            0 :           fputs (" acquired_lock=", dumpfile);
    3006            0 :           show_expr (c->expr4);
    3007              :         }
    3008            0 :       if (c->expr2 != NULL)
    3009              :         {
    3010            0 :           fputs (" stat=", dumpfile);
    3011            0 :           show_expr (c->expr2);
    3012              :         }
    3013            0 :       if (c->expr3 != NULL)
    3014              :         {
    3015            0 :           fputs (" errmsg=", dumpfile);
    3016            0 :           show_expr (c->expr3);
    3017              :         }
    3018              :       break;
    3019              : 
    3020            0 :     case EXEC_ARITHMETIC_IF:
    3021            0 :       fputs ("IF ", dumpfile);
    3022            0 :       show_expr (c->expr1);
    3023            0 :       fprintf (dumpfile, " %d, %d, %d",
    3024            0 :                   c->label1->value, c->label2->value, c->label3->value);
    3025            0 :       break;
    3026              : 
    3027           12 :     case EXEC_IF:
    3028           12 :       d = c->block;
    3029           12 :       fputs ("IF ", dumpfile);
    3030           12 :       show_expr (d->expr1);
    3031              : 
    3032           12 :       ++show_level;
    3033           12 :       show_code (level + 1, d->next);
    3034           12 :       --show_level;
    3035              : 
    3036           12 :       d = d->block;
    3037           12 :       for (; d; d = d->block)
    3038              :         {
    3039            0 :           fputs("\n", dumpfile);
    3040            0 :           code_indent (level, 0);
    3041            0 :           if (d->expr1 == NULL)
    3042            0 :             fputs ("ELSE", dumpfile);
    3043              :           else
    3044              :             {
    3045            0 :               fputs ("ELSE IF ", dumpfile);
    3046            0 :               show_expr (d->expr1);
    3047              :             }
    3048              : 
    3049            0 :           ++show_level;
    3050            0 :           show_code (level + 1, d->next);
    3051            0 :           --show_level;
    3052              :         }
    3053              : 
    3054           12 :       if (c->label1)
    3055            0 :         code_indent (level, c->label1);
    3056              :       else
    3057           12 :         show_indent ();
    3058              : 
    3059           12 :       fputs ("ENDIF", dumpfile);
    3060           12 :       break;
    3061              : 
    3062           24 :     case EXEC_CHANGE_TEAM:
    3063           24 :     case EXEC_BLOCK:
    3064           24 :       {
    3065           24 :         const char *blocktype, *sname = NULL;
    3066           24 :         gfc_namespace *saved_ns;
    3067           24 :         gfc_association_list *alist;
    3068              : 
    3069           24 :         if (c->ext.block.ns && c->ext.block.ns->code
    3070           24 :             && c->ext.block.ns->code->op == EXEC_SELECT_TYPE)
    3071              :           {
    3072           12 :             gfc_expr *fcn = c->ext.block.ns->code->expr1;
    3073           12 :             blocktype = "SELECT TYPE";
    3074              :             /* expr1 is _loc(assoc_name->vptr)  */
    3075           12 :             if (fcn && fcn->expr_type == EXPR_FUNCTION)
    3076           12 :               sname = fcn->value.function.actual->expr->symtree->n.sym->name;
    3077              :           }
    3078           12 :         else if (c->op == EXEC_CHANGE_TEAM)
    3079              :           blocktype = "CHANGE TEAM";
    3080           12 :         else if (c->ext.block.assoc)
    3081              :           blocktype = "ASSOCIATE";
    3082              :         else
    3083            0 :           blocktype = "BLOCK";
    3084           24 :         show_indent ();
    3085           24 :         fprintf (dumpfile, "%s ", blocktype);
    3086           24 :         if (c->op == EXEC_CHANGE_TEAM)
    3087            0 :           show_expr (c->expr1);
    3088           36 :         for (alist = c->ext.block.assoc; alist; alist = alist->next)
    3089              :           {
    3090           12 :             fprintf (dumpfile, " %s = ", sname ? sname : alist->name);
    3091           12 :             show_expr (alist->target);
    3092              :           }
    3093           24 :         if (c->op == EXEC_CHANGE_TEAM)
    3094            0 :           show_sync_stat (&c->ext.block.sync_stat);
    3095              : 
    3096           24 :         ++show_level;
    3097           24 :         ns = c->ext.block.ns;
    3098           24 :         saved_ns = gfc_current_ns;
    3099           24 :         gfc_current_ns = ns;
    3100           24 :         gfc_traverse_symtree (ns->sym_root, show_symtree);
    3101           24 :         gfc_current_ns = saved_ns;
    3102           24 :         show_code (show_level, ns->code);
    3103           24 :         --show_level;
    3104           24 :         if (c->op != EXEC_CHANGE_TEAM)
    3105              :           {
    3106              :             /* A CHANGE_TEAM is terminated by a END_TEAM, which have its own
    3107              :                stat and errmsg.  Therefore, let it print itself.  */
    3108           24 :             show_indent ();
    3109           24 :             fprintf (dumpfile, "END %s ", blocktype);
    3110              :           }
    3111              :         break;
    3112              :       }
    3113              : 
    3114              :     case EXEC_END_BLOCK:
    3115              :       /* Only come here when there is a label on an
    3116              :          END ASSOCIATE construct.  */
    3117              :       break;
    3118              : 
    3119           12 :     case EXEC_SELECT:
    3120           12 :     case EXEC_SELECT_TYPE:
    3121           12 :     case EXEC_SELECT_RANK:
    3122           12 :       d = c->block;
    3123           12 :       fputc ('\n', dumpfile);
    3124           12 :       code_indent (level, 0);
    3125           12 :       if (c->op == EXEC_SELECT_RANK)
    3126            0 :         fputs ("SELECT RANK ", dumpfile);
    3127           12 :       else if (c->op == EXEC_SELECT_TYPE)
    3128           12 :         fputs ("SELECT CASE ", dumpfile); // Preceded by SELECT TYPE construct
    3129              :       else
    3130            0 :         fputs ("SELECT CASE ", dumpfile);
    3131           12 :       show_expr (c->expr1);
    3132              : 
    3133           48 :       for (; d; d = d->block)
    3134              :         {
    3135           24 :           fputc ('\n', dumpfile);
    3136           24 :           code_indent (level, 0);
    3137           24 :           fputs ("CASE ", dumpfile);
    3138           48 :           for (cp = d->ext.block.case_list; cp; cp = cp->next)
    3139              :             {
    3140           24 :               fputc ('(', dumpfile);
    3141           24 :               show_expr (cp->low);
    3142           24 :               fputc (' ', dumpfile);
    3143           24 :               show_expr (cp->high);
    3144           24 :               fputc (')', dumpfile);
    3145           24 :               fputc (' ', dumpfile);
    3146              :             }
    3147              : 
    3148           24 :           show_code (level + 1, d->next);
    3149           24 :           fputc ('\n', dumpfile);
    3150              :         }
    3151              : 
    3152           12 :       code_indent (level, c->label1);
    3153           12 :       fputs ("END SELECT", dumpfile);
    3154           12 :       break;
    3155              : 
    3156            0 :     case EXEC_WHERE:
    3157            0 :       fputs ("WHERE ", dumpfile);
    3158              : 
    3159            0 :       d = c->block;
    3160            0 :       show_expr (d->expr1);
    3161            0 :       fputc ('\n', dumpfile);
    3162              : 
    3163            0 :       show_code (level + 1, d->next);
    3164              : 
    3165            0 :       for (d = d->block; d; d = d->block)
    3166              :         {
    3167            0 :           code_indent (level, 0);
    3168            0 :           fputs ("ELSE WHERE ", dumpfile);
    3169            0 :           show_expr (d->expr1);
    3170            0 :           fputc ('\n', dumpfile);
    3171            0 :           show_code (level + 1, d->next);
    3172              :         }
    3173              : 
    3174            0 :       code_indent (level, 0);
    3175            0 :       fputs ("END WHERE", dumpfile);
    3176            0 :       break;
    3177              : 
    3178              : 
    3179            0 :     case EXEC_FORALL:
    3180            0 :       fputs ("FORALL ", dumpfile);
    3181            0 :       for (fa = c->ext.concur.forall_iterator; fa; fa = fa->next)
    3182              :         {
    3183            0 :           show_expr (fa->var);
    3184            0 :           fputc (' ', dumpfile);
    3185            0 :           show_expr (fa->start);
    3186            0 :           fputc (':', dumpfile);
    3187            0 :           show_expr (fa->end);
    3188            0 :           fputc (':', dumpfile);
    3189            0 :           show_expr (fa->stride);
    3190              : 
    3191            0 :           if (fa->next != NULL)
    3192            0 :             fputc (',', dumpfile);
    3193              :         }
    3194              : 
    3195            0 :       if (c->expr1 != NULL)
    3196              :         {
    3197            0 :           fputc (',', dumpfile);
    3198            0 :           show_expr (c->expr1);
    3199              :         }
    3200            0 :       fputc ('\n', dumpfile);
    3201              : 
    3202            0 :       show_code (level + 1, c->block->next);
    3203              : 
    3204            0 :       code_indent (level, 0);
    3205            0 :       fputs ("END FORALL", dumpfile);
    3206            0 :       break;
    3207              : 
    3208            0 :     case EXEC_CRITICAL:
    3209            0 :       fputs ("CRITICAL", dumpfile);
    3210            0 :       show_sync_stat (&c->ext.sync_stat);
    3211            0 :       fputc ('\n', dumpfile);
    3212            0 :       show_code (level + 1, c->block->next);
    3213            0 :       code_indent (level, 0);
    3214            0 :       fputs ("END CRITICAL", dumpfile);
    3215            0 :       break;
    3216              : 
    3217            0 :     case EXEC_DO:
    3218            0 :       fputs ("DO ", dumpfile);
    3219            0 :       if (c->label1)
    3220            0 :         fprintf (dumpfile, " %-5d ", c->label1->value);
    3221              : 
    3222            0 :       show_expr (c->ext.iterator->var);
    3223            0 :       fputc ('=', dumpfile);
    3224            0 :       show_expr (c->ext.iterator->start);
    3225            0 :       fputc (' ', dumpfile);
    3226            0 :       show_expr (c->ext.iterator->end);
    3227            0 :       fputc (' ', dumpfile);
    3228            0 :       show_expr (c->ext.iterator->step);
    3229              : 
    3230            0 :       ++show_level;
    3231            0 :       show_code (level + 1, c->block->next);
    3232            0 :       --show_level;
    3233              : 
    3234            0 :       if (c->label1)
    3235              :         break;
    3236              : 
    3237            0 :       show_indent ();
    3238            0 :       fputs ("END DO", dumpfile);
    3239            0 :       break;
    3240              : 
    3241            0 :     case EXEC_DO_CONCURRENT:
    3242            0 :       fputs ("DO CONCURRENT ", dumpfile);
    3243            0 :       for (fa = c->ext.concur.forall_iterator; fa; fa = fa->next)
    3244              :         {
    3245            0 :           show_expr (fa->var);
    3246            0 :           fputc (' ', dumpfile);
    3247            0 :           show_expr (fa->start);
    3248            0 :           fputc (':', dumpfile);
    3249            0 :           show_expr (fa->end);
    3250            0 :           fputc (':', dumpfile);
    3251            0 :           show_expr (fa->stride);
    3252              : 
    3253            0 :           if (fa->next != NULL)
    3254            0 :             fputc (',', dumpfile);
    3255              :         }
    3256              : 
    3257            0 :       if (c->expr1 != NULL)
    3258              :         {
    3259            0 :           fputc (',', dumpfile);
    3260            0 :           show_expr (c->expr1);
    3261              :         }
    3262              : 
    3263            0 :       if (c->ext.concur.locality[LOCALITY_LOCAL])
    3264              :         {
    3265            0 :           fputs (" LOCAL (", dumpfile);
    3266              : 
    3267            0 :           for (gfc_expr_list *el = c->ext.concur.locality[LOCALITY_LOCAL];
    3268            0 :                el; el = el->next)
    3269              :             {
    3270            0 :               show_expr (el->expr);
    3271            0 :               if (el->next)
    3272            0 :                 fputc (',', dumpfile);
    3273              :             }
    3274            0 :           fputc (')', dumpfile);
    3275              :         }
    3276              : 
    3277            0 :       if (c->ext.concur.locality[LOCALITY_LOCAL_INIT])
    3278              :         {
    3279            0 :           fputs (" LOCAL_INIT (", dumpfile);
    3280            0 :           for (gfc_expr_list *el = c->ext.concur.locality[LOCALITY_LOCAL_INIT];
    3281            0 :                el; el = el->next)
    3282              :           {
    3283            0 :             show_expr (el->expr);
    3284            0 :             if (el->next)
    3285            0 :               fputc (',', dumpfile);
    3286              :           }
    3287            0 :           fputc (')', dumpfile);
    3288              :         }
    3289              : 
    3290            0 :       if (c->ext.concur.locality[LOCALITY_SHARED])
    3291              :         {
    3292            0 :           fputs (" SHARED (", dumpfile);
    3293            0 :           for (gfc_expr_list *el = c->ext.concur.locality[LOCALITY_SHARED];
    3294            0 :                el; el = el->next)
    3295              :             {
    3296            0 :               show_expr (el->expr);
    3297            0 :               if (el->next)
    3298            0 :                 fputc (',', dumpfile);
    3299              :             }
    3300            0 :           fputc (')', dumpfile);
    3301              :         }
    3302              : 
    3303            0 :       if (c->ext.concur.default_none)
    3304              :         {
    3305            0 :           fputs (" DEFAULT (NONE)", dumpfile);
    3306              :         }
    3307              : 
    3308            0 :       if (c->ext.concur.locality[LOCALITY_REDUCE])
    3309              :         {
    3310              :           gfc_expr_list *el = c->ext.concur.locality[LOCALITY_REDUCE];
    3311            0 :           while (el)
    3312              :             {
    3313            0 :               fputs (" REDUCE (", dumpfile);
    3314            0 :               if (el->expr)
    3315              :                 {
    3316            0 :                   if (el->expr->expr_type == EXPR_FUNCTION)
    3317              :                     {
    3318            0 :                       const char *name;
    3319            0 :                       switch (el->expr->value.function.isym->id)
    3320              :                         {
    3321              :                           case GFC_ISYM_MIN:
    3322              :                             name = "MIN";
    3323              :                             break;
    3324            0 :                           case GFC_ISYM_MAX:
    3325            0 :                             name = "MAX";
    3326            0 :                             break;
    3327            0 :                           case GFC_ISYM_IAND:
    3328            0 :                             name = "IAND";
    3329            0 :                             break;
    3330            0 :                           case GFC_ISYM_IOR:
    3331            0 :                             name = "IOR";
    3332            0 :                             break;
    3333            0 :                           case GFC_ISYM_IEOR:
    3334            0 :                             name = "IEOR";
    3335            0 :                             break;
    3336            0 :                           default:
    3337            0 :                             gcc_unreachable ();
    3338              :                         }
    3339            0 :                       fputs (name, dumpfile);
    3340              :                     }
    3341              :                   else
    3342            0 :                     show_expr (el->expr);
    3343              :                 }
    3344              :               else
    3345              :                 {
    3346            0 :                   fputs ("(NULL)", dumpfile);
    3347              :                 }
    3348              : 
    3349            0 :               fputc (':', dumpfile);
    3350            0 :               el = el->next;
    3351              : 
    3352            0 :               while (el && el->expr && el->expr->expr_type == EXPR_VARIABLE)
    3353              :                 {
    3354            0 :                   show_expr (el->expr);
    3355            0 :                   el = el->next;
    3356            0 :                   if (el && el->expr && el->expr->expr_type == EXPR_VARIABLE)
    3357            0 :                     fputc (',', dumpfile);
    3358              :                 }
    3359              : 
    3360            0 :               fputc (')', dumpfile);
    3361              :             }
    3362              :         }
    3363              : 
    3364            0 :       ++show_level;
    3365              : 
    3366            0 :       show_code (level + 1, c->block->next);
    3367            0 :       --show_level;
    3368            0 :       code_indent (level, c->label1);
    3369            0 :       show_indent ();
    3370            0 :       fputs ("END DO", dumpfile);
    3371            0 :       break;
    3372              : 
    3373            0 :     case EXEC_DO_WHILE:
    3374            0 :       fputs ("DO WHILE ", dumpfile);
    3375            0 :       show_expr (c->expr1);
    3376            0 :       fputc ('\n', dumpfile);
    3377              : 
    3378            0 :       show_code (level + 1, c->block->next);
    3379              : 
    3380            0 :       code_indent (level, c->label1);
    3381            0 :       fputs ("END DO", dumpfile);
    3382            0 :       break;
    3383              : 
    3384            0 :     case EXEC_CYCLE:
    3385            0 :       fputs ("CYCLE", dumpfile);
    3386            0 :       if (c->symtree)
    3387            0 :         fprintf (dumpfile, " %s", c->symtree->n.sym->name);
    3388              :       break;
    3389              : 
    3390            0 :     case EXEC_EXIT:
    3391            0 :       fputs ("EXIT", dumpfile);
    3392            0 :       if (c->symtree)
    3393            0 :         fprintf (dumpfile, " %s", c->symtree->n.sym->name);
    3394              :       break;
    3395              : 
    3396           12 :     case EXEC_ALLOCATE:
    3397           12 :       fputs ("ALLOCATE ", dumpfile);
    3398           12 :       if (c->expr1)
    3399              :         {
    3400            0 :           fputs (" STAT=", dumpfile);
    3401            0 :           show_expr (c->expr1);
    3402              :         }
    3403              : 
    3404           12 :       if (c->expr2)
    3405              :         {
    3406            0 :           fputs (" ERRMSG=", dumpfile);
    3407            0 :           show_expr (c->expr2);
    3408              :         }
    3409              : 
    3410           12 :       if (c->expr3)
    3411              :         {
    3412           12 :           if (c->expr3->mold)
    3413            0 :             fputs (" MOLD=", dumpfile);
    3414              :           else
    3415           12 :             fputs (" SOURCE=", dumpfile);
    3416           12 :           show_expr (c->expr3);
    3417              :         }
    3418              : 
    3419           24 :       for (a = c->ext.alloc.list; a; a = a->next)
    3420              :         {
    3421           12 :           fputc (' ', dumpfile);
    3422           12 :           show_expr (a->expr);
    3423              :         }
    3424              : 
    3425              :       break;
    3426              : 
    3427            0 :     case EXEC_DEALLOCATE:
    3428            0 :       fputs ("DEALLOCATE ", dumpfile);
    3429            0 :       if (c->expr1)
    3430              :         {
    3431            0 :           fputs (" STAT=", dumpfile);
    3432            0 :           show_expr (c->expr1);
    3433              :         }
    3434              : 
    3435            0 :       if (c->expr2)
    3436              :         {
    3437            0 :           fputs (" ERRMSG=", dumpfile);
    3438            0 :           show_expr (c->expr2);
    3439              :         }
    3440              : 
    3441            0 :       for (a = c->ext.alloc.list; a; a = a->next)
    3442              :         {
    3443            0 :           fputc (' ', dumpfile);
    3444            0 :           show_expr (a->expr);
    3445              :         }
    3446              : 
    3447              :       break;
    3448              : 
    3449            0 :     case EXEC_OPEN:
    3450            0 :       fputs ("OPEN", dumpfile);
    3451            0 :       open = c->ext.open;
    3452              : 
    3453            0 :       if (open->unit)
    3454              :         {
    3455            0 :           fputs (" UNIT=", dumpfile);
    3456            0 :           show_expr (open->unit);
    3457              :         }
    3458            0 :       if (open->iomsg)
    3459              :         {
    3460            0 :           fputs (" IOMSG=", dumpfile);
    3461            0 :           show_expr (open->iomsg);
    3462              :         }
    3463            0 :       if (open->iostat)
    3464              :         {
    3465            0 :           fputs (" IOSTAT=", dumpfile);
    3466            0 :           show_expr (open->iostat);
    3467              :         }
    3468            0 :       if (open->file)
    3469              :         {
    3470            0 :           fputs (" FILE=", dumpfile);
    3471            0 :           show_expr (open->file);
    3472              :         }
    3473            0 :       if (open->status)
    3474              :         {
    3475            0 :           fputs (" STATUS=", dumpfile);
    3476            0 :           show_expr (open->status);
    3477              :         }
    3478            0 :       if (open->access)
    3479              :         {
    3480            0 :           fputs (" ACCESS=", dumpfile);
    3481            0 :           show_expr (open->access);
    3482              :         }
    3483            0 :       if (open->form)
    3484              :         {
    3485            0 :           fputs (" FORM=", dumpfile);
    3486            0 :           show_expr (open->form);
    3487              :         }
    3488            0 :       if (open->recl)
    3489              :         {
    3490            0 :           fputs (" RECL=", dumpfile);
    3491            0 :           show_expr (open->recl);
    3492              :         }
    3493            0 :       if (open->blank)
    3494              :         {
    3495            0 :           fputs (" BLANK=", dumpfile);
    3496            0 :           show_expr (open->blank);
    3497              :         }
    3498            0 :       if (open->position)
    3499              :         {
    3500            0 :           fputs (" POSITION=", dumpfile);
    3501            0 :           show_expr (open->position);
    3502              :         }
    3503            0 :       if (open->action)
    3504              :         {
    3505            0 :           fputs (" ACTION=", dumpfile);
    3506            0 :           show_expr (open->action);
    3507              :         }
    3508            0 :       if (open->delim)
    3509              :         {
    3510            0 :           fputs (" DELIM=", dumpfile);
    3511            0 :           show_expr (open->delim);
    3512              :         }
    3513            0 :       if (open->pad)
    3514              :         {
    3515            0 :           fputs (" PAD=", dumpfile);
    3516            0 :           show_expr (open->pad);
    3517              :         }
    3518            0 :       if (open->decimal)
    3519              :         {
    3520            0 :           fputs (" DECIMAL=", dumpfile);
    3521            0 :           show_expr (open->decimal);
    3522              :         }
    3523            0 :       if (open->encoding)
    3524              :         {
    3525            0 :           fputs (" ENCODING=", dumpfile);
    3526            0 :           show_expr (open->encoding);
    3527              :         }
    3528            0 :       if (open->round)
    3529              :         {
    3530            0 :           fputs (" ROUND=", dumpfile);
    3531            0 :           show_expr (open->round);
    3532              :         }
    3533            0 :       if (open->sign)
    3534              :         {
    3535            0 :           fputs (" SIGN=", dumpfile);
    3536            0 :           show_expr (open->sign);
    3537              :         }
    3538            0 :       if (open->convert)
    3539              :         {
    3540            0 :           fputs (" CONVERT=", dumpfile);
    3541            0 :           show_expr (open->convert);
    3542              :         }
    3543            0 :       if (open->asynchronous)
    3544              :         {
    3545            0 :           fputs (" ASYNCHRONOUS=", dumpfile);
    3546            0 :           show_expr (open->asynchronous);
    3547              :         }
    3548            0 :       if (open->err != NULL)
    3549            0 :         fprintf (dumpfile, " ERR=%d", open->err->value);
    3550              : 
    3551              :       break;
    3552              : 
    3553            0 :     case EXEC_CLOSE:
    3554            0 :       fputs ("CLOSE", dumpfile);
    3555            0 :       close = c->ext.close;
    3556              : 
    3557            0 :       if (close->unit)
    3558              :         {
    3559            0 :           fputs (" UNIT=", dumpfile);
    3560            0 :           show_expr (close->unit);
    3561              :         }
    3562            0 :       if (close->iomsg)
    3563              :         {
    3564            0 :           fputs (" IOMSG=", dumpfile);
    3565            0 :           show_expr (close->iomsg);
    3566              :         }
    3567            0 :       if (close->iostat)
    3568              :         {
    3569            0 :           fputs (" IOSTAT=", dumpfile);
    3570            0 :           show_expr (close->iostat);
    3571              :         }
    3572            0 :       if (close->status)
    3573              :         {
    3574            0 :           fputs (" STATUS=", dumpfile);
    3575            0 :           show_expr (close->status);
    3576              :         }
    3577            0 :       if (close->err != NULL)
    3578            0 :         fprintf (dumpfile, " ERR=%d", close->err->value);
    3579              :       break;
    3580              : 
    3581            0 :     case EXEC_BACKSPACE:
    3582            0 :       fputs ("BACKSPACE", dumpfile);
    3583            0 :       goto show_filepos;
    3584              : 
    3585            0 :     case EXEC_ENDFILE:
    3586            0 :       fputs ("ENDFILE", dumpfile);
    3587            0 :       goto show_filepos;
    3588              : 
    3589            0 :     case EXEC_REWIND:
    3590            0 :       fputs ("REWIND", dumpfile);
    3591            0 :       goto show_filepos;
    3592              : 
    3593            0 :     case EXEC_FLUSH:
    3594            0 :       fputs ("FLUSH", dumpfile);
    3595              : 
    3596            0 :     show_filepos:
    3597            0 :       fp = c->ext.filepos;
    3598              : 
    3599            0 :       if (fp->unit)
    3600              :         {
    3601            0 :           fputs (" UNIT=", dumpfile);
    3602            0 :           show_expr (fp->unit);
    3603              :         }
    3604            0 :       if (fp->iomsg)
    3605              :         {
    3606            0 :           fputs (" IOMSG=", dumpfile);
    3607            0 :           show_expr (fp->iomsg);
    3608              :         }
    3609            0 :       if (fp->iostat)
    3610              :         {
    3611            0 :           fputs (" IOSTAT=", dumpfile);
    3612            0 :           show_expr (fp->iostat);
    3613              :         }
    3614            0 :       if (fp->err != NULL)
    3615            0 :         fprintf (dumpfile, " ERR=%d", fp->err->value);
    3616              :       break;
    3617              : 
    3618            0 :     case EXEC_INQUIRE:
    3619            0 :       fputs ("INQUIRE", dumpfile);
    3620            0 :       i = c->ext.inquire;
    3621              : 
    3622            0 :       if (i->unit)
    3623              :         {
    3624            0 :           fputs (" UNIT=", dumpfile);
    3625            0 :           show_expr (i->unit);
    3626              :         }
    3627            0 :       if (i->file)
    3628              :         {
    3629            0 :           fputs (" FILE=", dumpfile);
    3630            0 :           show_expr (i->file);
    3631              :         }
    3632              : 
    3633            0 :       if (i->iomsg)
    3634              :         {
    3635            0 :           fputs (" IOMSG=", dumpfile);
    3636            0 :           show_expr (i->iomsg);
    3637              :         }
    3638            0 :       if (i->iostat)
    3639              :         {
    3640            0 :           fputs (" IOSTAT=", dumpfile);
    3641            0 :           show_expr (i->iostat);
    3642              :         }
    3643            0 :       if (i->exist)
    3644              :         {
    3645            0 :           fputs (" EXIST=", dumpfile);
    3646            0 :           show_expr (i->exist);
    3647              :         }
    3648            0 :       if (i->opened)
    3649              :         {
    3650            0 :           fputs (" OPENED=", dumpfile);
    3651            0 :           show_expr (i->opened);
    3652              :         }
    3653            0 :       if (i->number)
    3654              :         {
    3655            0 :           fputs (" NUMBER=", dumpfile);
    3656            0 :           show_expr (i->number);
    3657              :         }
    3658            0 :       if (i->named)
    3659              :         {
    3660            0 :           fputs (" NAMED=", dumpfile);
    3661            0 :           show_expr (i->named);
    3662              :         }
    3663            0 :       if (i->name)
    3664              :         {
    3665            0 :           fputs (" NAME=", dumpfile);
    3666            0 :           show_expr (i->name);
    3667              :         }
    3668            0 :       if (i->access)
    3669              :         {
    3670            0 :           fputs (" ACCESS=", dumpfile);
    3671            0 :           show_expr (i->access);
    3672              :         }
    3673            0 :       if (i->sequential)
    3674              :         {
    3675            0 :           fputs (" SEQUENTIAL=", dumpfile);
    3676            0 :           show_expr (i->sequential);
    3677              :         }
    3678              : 
    3679            0 :       if (i->direct)
    3680              :         {
    3681            0 :           fputs (" DIRECT=", dumpfile);
    3682            0 :           show_expr (i->direct);
    3683              :         }
    3684            0 :       if (i->form)
    3685              :         {
    3686            0 :           fputs (" FORM=", dumpfile);
    3687            0 :           show_expr (i->form);
    3688              :         }
    3689            0 :       if (i->formatted)
    3690              :         {
    3691            0 :           fputs (" FORMATTED", dumpfile);
    3692            0 :           show_expr (i->formatted);
    3693              :         }
    3694            0 :       if (i->unformatted)
    3695              :         {
    3696            0 :           fputs (" UNFORMATTED=", dumpfile);
    3697            0 :           show_expr (i->unformatted);
    3698              :         }
    3699            0 :       if (i->recl)
    3700              :         {
    3701            0 :           fputs (" RECL=", dumpfile);
    3702            0 :           show_expr (i->recl);
    3703              :         }
    3704            0 :       if (i->nextrec)
    3705              :         {
    3706            0 :           fputs (" NEXTREC=", dumpfile);
    3707            0 :           show_expr (i->nextrec);
    3708              :         }
    3709            0 :       if (i->blank)
    3710              :         {
    3711            0 :           fputs (" BLANK=", dumpfile);
    3712            0 :           show_expr (i->blank);
    3713              :         }
    3714            0 :       if (i->position)
    3715              :         {
    3716            0 :           fputs (" POSITION=", dumpfile);
    3717            0 :           show_expr (i->position);
    3718              :         }
    3719            0 :       if (i->action)
    3720              :         {
    3721            0 :           fputs (" ACTION=", dumpfile);
    3722            0 :           show_expr (i->action);
    3723              :         }
    3724            0 :       if (i->read)
    3725              :         {
    3726            0 :           fputs (" READ=", dumpfile);
    3727            0 :           show_expr (i->read);
    3728              :         }
    3729            0 :       if (i->write)
    3730              :         {
    3731            0 :           fputs (" WRITE=", dumpfile);
    3732            0 :           show_expr (i->write);
    3733              :         }
    3734            0 :       if (i->readwrite)
    3735              :         {
    3736            0 :           fputs (" READWRITE=", dumpfile);
    3737            0 :           show_expr (i->readwrite);
    3738              :         }
    3739            0 :       if (i->delim)
    3740              :         {
    3741            0 :           fputs (" DELIM=", dumpfile);
    3742            0 :           show_expr (i->delim);
    3743              :         }
    3744            0 :       if (i->pad)
    3745              :         {
    3746            0 :           fputs (" PAD=", dumpfile);
    3747            0 :           show_expr (i->pad);
    3748              :         }
    3749            0 :       if (i->convert)
    3750              :         {
    3751            0 :           fputs (" CONVERT=", dumpfile);
    3752            0 :           show_expr (i->convert);
    3753              :         }
    3754            0 :       if (i->asynchronous)
    3755              :         {
    3756            0 :           fputs (" ASYNCHRONOUS=", dumpfile);
    3757            0 :           show_expr (i->asynchronous);
    3758              :         }
    3759            0 :       if (i->decimal)
    3760              :         {
    3761            0 :           fputs (" DECIMAL=", dumpfile);
    3762            0 :           show_expr (i->decimal);
    3763              :         }
    3764            0 :       if (i->encoding)
    3765              :         {
    3766            0 :           fputs (" ENCODING=", dumpfile);
    3767            0 :           show_expr (i->encoding);
    3768              :         }
    3769            0 :       if (i->pending)
    3770              :         {
    3771            0 :           fputs (" PENDING=", dumpfile);
    3772            0 :           show_expr (i->pending);
    3773              :         }
    3774            0 :       if (i->round)
    3775              :         {
    3776            0 :           fputs (" ROUND=", dumpfile);
    3777            0 :           show_expr (i->round);
    3778              :         }
    3779            0 :       if (i->sign)
    3780              :         {
    3781            0 :           fputs (" SIGN=", dumpfile);
    3782            0 :           show_expr (i->sign);
    3783              :         }
    3784            0 :       if (i->size)
    3785              :         {
    3786            0 :           fputs (" SIZE=", dumpfile);
    3787            0 :           show_expr (i->size);
    3788              :         }
    3789            0 :       if (i->id)
    3790              :         {
    3791            0 :           fputs (" ID=", dumpfile);
    3792            0 :           show_expr (i->id);
    3793              :         }
    3794              : 
    3795            0 :       if (i->err != NULL)
    3796            0 :         fprintf (dumpfile, " ERR=%d", i->err->value);
    3797              :       break;
    3798              : 
    3799            0 :     case EXEC_IOLENGTH:
    3800            0 :       fputs ("IOLENGTH ", dumpfile);
    3801            0 :       show_expr (c->expr1);
    3802            0 :       goto show_dt_code;
    3803            0 :       break;
    3804              : 
    3805            0 :     case EXEC_READ:
    3806            0 :       fputs ("READ", dumpfile);
    3807            0 :       goto show_dt;
    3808              : 
    3809           34 :     case EXEC_WRITE:
    3810           34 :       fputs ("WRITE", dumpfile);
    3811              : 
    3812           34 :     show_dt:
    3813           34 :       dt = c->ext.dt;
    3814           34 :       if (dt->io_unit)
    3815              :         {
    3816           34 :           fputs (" UNIT=", dumpfile);
    3817           34 :           show_expr (dt->io_unit);
    3818              :         }
    3819              : 
    3820           34 :       if (dt->format_expr)
    3821              :         {
    3822            0 :           fputs (" FMT=", dumpfile);
    3823            0 :           show_expr (dt->format_expr);
    3824              :         }
    3825              : 
    3826           34 :       if (dt->format_label != NULL)
    3827           34 :         fprintf (dumpfile, " FMT=%d", dt->format_label->value);
    3828           34 :       if (dt->namelist)
    3829            0 :         fprintf (dumpfile, " NML=%s", dt->namelist->name);
    3830              : 
    3831           34 :       if (dt->iomsg)
    3832              :         {
    3833            0 :           fputs (" IOMSG=", dumpfile);
    3834            0 :           show_expr (dt->iomsg);
    3835              :         }
    3836           34 :       if (dt->iostat)
    3837              :         {
    3838            0 :           fputs (" IOSTAT=", dumpfile);
    3839            0 :           show_expr (dt->iostat);
    3840              :         }
    3841           34 :       if (dt->size)
    3842              :         {
    3843            0 :           fputs (" SIZE=", dumpfile);
    3844            0 :           show_expr (dt->size);
    3845              :         }
    3846           34 :       if (dt->rec)
    3847              :         {
    3848            0 :           fputs (" REC=", dumpfile);
    3849            0 :           show_expr (dt->rec);
    3850              :         }
    3851           34 :       if (dt->advance)
    3852              :         {
    3853            0 :           fputs (" ADVANCE=", dumpfile);
    3854            0 :           show_expr (dt->advance);
    3855              :         }
    3856           34 :       if (dt->id)
    3857              :         {
    3858            0 :           fputs (" ID=", dumpfile);
    3859            0 :           show_expr (dt->id);
    3860              :         }
    3861           34 :       if (dt->pos)
    3862              :         {
    3863            0 :           fputs (" POS=", dumpfile);
    3864            0 :           show_expr (dt->pos);
    3865              :         }
    3866           34 :       if (dt->asynchronous)
    3867              :         {
    3868            0 :           fputs (" ASYNCHRONOUS=", dumpfile);
    3869            0 :           show_expr (dt->asynchronous);
    3870              :         }
    3871           34 :       if (dt->blank)
    3872              :         {
    3873            0 :           fputs (" BLANK=", dumpfile);
    3874            0 :           show_expr (dt->blank);
    3875              :         }
    3876           34 :       if (dt->decimal)
    3877              :         {
    3878            0 :           fputs (" DECIMAL=", dumpfile);
    3879            0 :           show_expr (dt->decimal);
    3880              :         }
    3881           34 :       if (dt->delim)
    3882              :         {
    3883            0 :           fputs (" DELIM=", dumpfile);
    3884            0 :           show_expr (dt->delim);
    3885              :         }
    3886           34 :       if (dt->pad)
    3887              :         {
    3888            0 :           fputs (" PAD=", dumpfile);
    3889            0 :           show_expr (dt->pad);
    3890              :         }
    3891           34 :       if (dt->round)
    3892              :         {
    3893            0 :           fputs (" ROUND=", dumpfile);
    3894            0 :           show_expr (dt->round);
    3895              :         }
    3896           34 :       if (dt->sign)
    3897              :         {
    3898            0 :           fputs (" SIGN=", dumpfile);
    3899            0 :           show_expr (dt->sign);
    3900              :         }
    3901              : 
    3902           34 :     show_dt_code:
    3903          102 :       for (c = c->block->next; c; c = c->next)
    3904           68 :         show_code_node (level + (c->next != NULL), c);
    3905              :       return;
    3906              : 
    3907           34 :     case EXEC_TRANSFER:
    3908           34 :       fputs ("TRANSFER ", dumpfile);
    3909           34 :       show_expr (c->expr1);
    3910           34 :       break;
    3911              : 
    3912           34 :     case EXEC_DT_END:
    3913           34 :       fputs ("DT_END", dumpfile);
    3914           34 :       dt = c->ext.dt;
    3915              : 
    3916           34 :       if (dt->err != NULL)
    3917            0 :         fprintf (dumpfile, " ERR=%d", dt->err->value);
    3918           34 :       if (dt->end != NULL)
    3919            0 :         fprintf (dumpfile, " END=%d", dt->end->value);
    3920           34 :       if (dt->eor != NULL)
    3921            0 :         fprintf (dumpfile, " EOR=%d", dt->eor->value);
    3922              :       break;
    3923              : 
    3924            0 :     case EXEC_WAIT:
    3925            0 :       fputs ("WAIT", dumpfile);
    3926              : 
    3927            0 :       if (c->ext.wait != NULL)
    3928              :         {
    3929            0 :           gfc_wait *wait = c->ext.wait;
    3930            0 :           if (wait->unit)
    3931              :             {
    3932            0 :               fputs (" UNIT=", dumpfile);
    3933            0 :               show_expr (wait->unit);
    3934              :             }
    3935            0 :           if (wait->iostat)
    3936              :             {
    3937            0 :               fputs (" IOSTAT=", dumpfile);
    3938            0 :               show_expr (wait->iostat);
    3939              :             }
    3940            0 :           if (wait->iomsg)
    3941              :             {
    3942            0 :               fputs (" IOMSG=", dumpfile);
    3943            0 :               show_expr (wait->iomsg);
    3944              :             }
    3945            0 :           if (wait->id)
    3946              :             {
    3947            0 :               fputs (" ID=", dumpfile);
    3948            0 :               show_expr (wait->id);
    3949              :             }
    3950            0 :           if (wait->err)
    3951            0 :             fprintf (dumpfile, " ERR=%d", wait->err->value);
    3952            0 :           if (wait->end)
    3953            0 :             fprintf (dumpfile, " END=%d", wait->end->value);
    3954            0 :           if (wait->eor)
    3955            0 :             fprintf (dumpfile, " EOR=%d", wait->eor->value);
    3956              :         }
    3957              :       break;
    3958              : 
    3959            0 :     case EXEC_OACC_PARALLEL_LOOP:
    3960            0 :     case EXEC_OACC_PARALLEL:
    3961            0 :     case EXEC_OACC_KERNELS_LOOP:
    3962            0 :     case EXEC_OACC_KERNELS:
    3963            0 :     case EXEC_OACC_SERIAL_LOOP:
    3964            0 :     case EXEC_OACC_SERIAL:
    3965            0 :     case EXEC_OACC_DATA:
    3966            0 :     case EXEC_OACC_HOST_DATA:
    3967            0 :     case EXEC_OACC_LOOP:
    3968            0 :     case EXEC_OACC_UPDATE:
    3969            0 :     case EXEC_OACC_WAIT:
    3970            0 :     case EXEC_OACC_CACHE:
    3971            0 :     case EXEC_OACC_ENTER_DATA:
    3972            0 :     case EXEC_OACC_EXIT_DATA:
    3973            0 :     case EXEC_OMP_ALLOCATE:
    3974            0 :     case EXEC_OMP_ALLOCATORS:
    3975            0 :     case EXEC_OMP_ASSUME:
    3976            0 :     case EXEC_OMP_ATOMIC:
    3977            0 :     case EXEC_OMP_CANCEL:
    3978            0 :     case EXEC_OMP_CANCELLATION_POINT:
    3979            0 :     case EXEC_OMP_BARRIER:
    3980            0 :     case EXEC_OMP_CRITICAL:
    3981            0 :     case EXEC_OMP_DEPOBJ:
    3982            0 :     case EXEC_OMP_DISPATCH:
    3983            0 :     case EXEC_OMP_DISTRIBUTE:
    3984            0 :     case EXEC_OMP_DISTRIBUTE_PARALLEL_DO:
    3985            0 :     case EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD:
    3986            0 :     case EXEC_OMP_DISTRIBUTE_SIMD:
    3987            0 :     case EXEC_OMP_DO:
    3988            0 :     case EXEC_OMP_DO_SIMD:
    3989            0 :     case EXEC_OMP_ERROR:
    3990            0 :     case EXEC_OMP_INTEROP:
    3991            0 :     case EXEC_OMP_FLUSH:
    3992            0 :     case EXEC_OMP_LOOP:
    3993            0 :     case EXEC_OMP_MASKED:
    3994            0 :     case EXEC_OMP_MASKED_TASKLOOP:
    3995            0 :     case EXEC_OMP_MASKED_TASKLOOP_SIMD:
    3996            0 :     case EXEC_OMP_MASTER:
    3997            0 :     case EXEC_OMP_MASTER_TASKLOOP:
    3998            0 :     case EXEC_OMP_MASTER_TASKLOOP_SIMD:
    3999            0 :     case EXEC_OMP_METADIRECTIVE:
    4000            0 :     case EXEC_OMP_ORDERED:
    4001            0 :     case EXEC_OMP_PARALLEL:
    4002            0 :     case EXEC_OMP_PARALLEL_DO:
    4003            0 :     case EXEC_OMP_PARALLEL_DO_SIMD:
    4004            0 :     case EXEC_OMP_PARALLEL_LOOP:
    4005            0 :     case EXEC_OMP_PARALLEL_MASKED:
    4006            0 :     case EXEC_OMP_PARALLEL_MASKED_TASKLOOP:
    4007            0 :     case EXEC_OMP_PARALLEL_MASKED_TASKLOOP_SIMD:
    4008            0 :     case EXEC_OMP_PARALLEL_MASTER:
    4009            0 :     case EXEC_OMP_PARALLEL_MASTER_TASKLOOP:
    4010            0 :     case EXEC_OMP_PARALLEL_MASTER_TASKLOOP_SIMD:
    4011            0 :     case EXEC_OMP_PARALLEL_SECTIONS:
    4012            0 :     case EXEC_OMP_PARALLEL_WORKSHARE:
    4013            0 :     case EXEC_OMP_SCAN:
    4014            0 :     case EXEC_OMP_SCOPE:
    4015            0 :     case EXEC_OMP_SECTIONS:
    4016            0 :     case EXEC_OMP_SIMD:
    4017            0 :     case EXEC_OMP_SINGLE:
    4018            0 :     case EXEC_OMP_TARGET:
    4019            0 :     case EXEC_OMP_TARGET_DATA:
    4020            0 :     case EXEC_OMP_TARGET_ENTER_DATA:
    4021            0 :     case EXEC_OMP_TARGET_EXIT_DATA:
    4022            0 :     case EXEC_OMP_TARGET_PARALLEL:
    4023            0 :     case EXEC_OMP_TARGET_PARALLEL_DO:
    4024            0 :     case EXEC_OMP_TARGET_PARALLEL_DO_SIMD:
    4025            0 :     case EXEC_OMP_TARGET_PARALLEL_LOOP:
    4026            0 :     case EXEC_OMP_TARGET_SIMD:
    4027            0 :     case EXEC_OMP_TARGET_TEAMS:
    4028            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE:
    4029            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO:
    4030            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
    4031            0 :     case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD:
    4032            0 :     case EXEC_OMP_TARGET_TEAMS_LOOP:
    4033            0 :     case EXEC_OMP_TARGET_UPDATE:
    4034            0 :     case EXEC_OMP_TASK:
    4035            0 :     case EXEC_OMP_TASKGROUP:
    4036            0 :     case EXEC_OMP_TASKLOOP:
    4037            0 :     case EXEC_OMP_TASKLOOP_SIMD:
    4038            0 :     case EXEC_OMP_TASKWAIT:
    4039            0 :     case EXEC_OMP_TASKYIELD:
    4040            0 :     case EXEC_OMP_TEAMS:
    4041            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE:
    4042            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO:
    4043            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
    4044            0 :     case EXEC_OMP_TEAMS_DISTRIBUTE_SIMD:
    4045            0 :     case EXEC_OMP_TEAMS_LOOP:
    4046            0 :     case EXEC_OMP_TILE:
    4047            0 :     case EXEC_OMP_UNROLL:
    4048            0 :     case EXEC_OMP_WORKSHARE:
    4049            0 :       show_omp_node (level, c);
    4050            0 :       break;
    4051              : 
    4052            0 :     default:
    4053            0 :       gfc_internal_error ("show_code_node(): Bad statement code");
    4054              :     }
    4055              : }
    4056              : 
    4057              : 
    4058              : /* Show an equivalence chain.  */
    4059              : 
    4060              : static void
    4061            0 : show_equiv (gfc_equiv *eq)
    4062              : {
    4063            0 :   show_indent ();
    4064            0 :   fputs ("Equivalence: ", dumpfile);
    4065            0 :   while (eq)
    4066              :     {
    4067            0 :       show_expr (eq->expr);
    4068            0 :       eq = eq->eq;
    4069            0 :       if (eq)
    4070            0 :         fputs (", ", dumpfile);
    4071              :     }
    4072            0 : }
    4073              : 
    4074              : 
    4075              : /* Show a freakin' whole namespace.  */
    4076              : 
    4077              : static void
    4078           52 : show_namespace (gfc_namespace *ns)
    4079              : {
    4080           52 :   gfc_interface *intr;
    4081           52 :   gfc_namespace *save;
    4082           52 :   int op;
    4083           52 :   gfc_equiv *eq;
    4084           52 :   int i;
    4085              : 
    4086           52 :   gcc_assert (ns);
    4087           52 :   save = gfc_current_ns;
    4088              : 
    4089           52 :   show_indent ();
    4090           52 :   fputs ("Namespace:", dumpfile);
    4091              : 
    4092           52 :   i = 0;
    4093           88 :   do
    4094              :     {
    4095           88 :       int l = i;
    4096           88 :       while (i < GFC_LETTERS - 1
    4097         1352 :              && gfc_compare_types (&ns->default_type[i+1],
    4098              :                                    &ns->default_type[l]))
    4099              :         i++;
    4100              : 
    4101           88 :       if (i > l)
    4102           82 :         fprintf (dumpfile, " %c-%c: ", l+'A', i+'A');
    4103              :       else
    4104            6 :         fprintf (dumpfile, " %c: ", l+'A');
    4105              : 
    4106           88 :       show_typespec(&ns->default_type[l]);
    4107           88 :       i++;
    4108           88 :     } while (i < GFC_LETTERS);
    4109              : 
    4110           52 :   if (ns->proc_name != NULL)
    4111              :     {
    4112           52 :       show_indent ();
    4113           52 :       fprintf (dumpfile, "procedure name = %s", ns->proc_name->name);
    4114              :     }
    4115              : 
    4116           52 :   ++show_level;
    4117           52 :   gfc_current_ns = ns;
    4118           52 :   gfc_traverse_symtree (ns->common_root, show_common);
    4119              : 
    4120           52 :   gfc_traverse_symtree (ns->sym_root, show_symtree);
    4121              : 
    4122         1560 :   for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; op++)
    4123              :     {
    4124              :       /* User operator interfaces */
    4125         1456 :       intr = ns->op[op];
    4126         1456 :       if (intr == NULL)
    4127         1456 :         continue;
    4128              : 
    4129            0 :       show_indent ();
    4130            0 :       fprintf (dumpfile, "Operator interfaces for %s:",
    4131              :                gfc_op2string ((gfc_intrinsic_op) op));
    4132              : 
    4133            0 :       for (; intr; intr = intr->next)
    4134            0 :         fprintf (dumpfile, " %s", intr->sym->name);
    4135              :     }
    4136              : 
    4137           52 :   if (ns->uop_root != NULL)
    4138              :     {
    4139            0 :       show_indent ();
    4140            0 :       fputs ("User operators:\n", dumpfile);
    4141            0 :       gfc_traverse_user_op (ns, show_uop);
    4142              :     }
    4143              : 
    4144           52 :   for (eq = ns->equiv; eq; eq = eq->next)
    4145            0 :     show_equiv (eq);
    4146              : 
    4147           52 :   if (ns->oacc_declare)
    4148              :     {
    4149              :       struct gfc_oacc_declare *decl;
    4150              :       /* Dump !$ACC DECLARE clauses.  */
    4151            0 :       for (decl = ns->oacc_declare; decl; decl = decl->next)
    4152              :         {
    4153            0 :           show_indent ();
    4154            0 :           fprintf (dumpfile, "!$ACC DECLARE");
    4155            0 :           show_omp_clauses (decl->clauses);
    4156              :         }
    4157              :     }
    4158              : 
    4159           52 :   if (ns->omp_assumes)
    4160              :     {
    4161            0 :       show_indent ();
    4162            0 :       fprintf (dumpfile, "!$OMP ASSUMES");
    4163            0 :       show_omp_assumes (ns->omp_assumes);
    4164              :     }
    4165              : 
    4166           52 :   fputc ('\n', dumpfile);
    4167           52 :   show_indent ();
    4168           52 :   fputs ("code:", dumpfile);
    4169           52 :   show_code (show_level, ns->code);
    4170           52 :   --show_level;
    4171              : 
    4172           64 :   for (ns = ns->contained; ns; ns = ns->sibling)
    4173              :     {
    4174           12 :       fputs ("\nCONTAINS\n", dumpfile);
    4175           12 :       ++show_level;
    4176           12 :       show_namespace (ns);
    4177           12 :       --show_level;
    4178              :     }
    4179              : 
    4180           52 :   fputc ('\n', dumpfile);
    4181           52 :   gfc_current_ns = save;
    4182           52 : }
    4183              : 
    4184              : 
    4185              : /* Main function for dumping a parse tree.  */
    4186              : 
    4187              : void
    4188           40 : gfc_dump_parse_tree (gfc_namespace *ns, FILE *file)
    4189              : {
    4190           40 :   dumpfile = file;
    4191           40 :   show_namespace (ns);
    4192           40 : }
    4193              : 
    4194              : /* This part writes BIND(C) prototypes and declarations, and prototypes
    4195              :    for EXTERNAL procedures, for use in a C programs.  */
    4196              : 
    4197              : static void write_interop_decl (gfc_symbol *);
    4198              : static void write_proc (gfc_symbol *, bool);
    4199              : static void show_external_symbol (gfc_gsymbol *, void *);
    4200              : static void write_type (gfc_symbol *sym);
    4201              : static void write_funptr_fcn (gfc_symbol *);
    4202              : 
    4203              : /* Do we need to write out an #include <ISO_Fortran_binding.h> or not?  */
    4204              : 
    4205              : static void
    4206            0 : has_cfi_cdesc (gfc_gsymbol *gsym, void *p)
    4207              : {
    4208            0 :   bool *data_p = (bool *) p;
    4209            0 :   gfc_formal_arglist *f;
    4210            0 :   gfc_symbol *sym;
    4211              : 
    4212            0 :   if (*data_p)
    4213            0 :     return;
    4214              : 
    4215            0 :   if (gsym->ns == NULL || gsym->sym_name == NULL )
    4216              :     return;
    4217              : 
    4218            0 :   gfc_find_symbol (gsym->sym_name, gsym->ns, 0, &sym);
    4219              : 
    4220            0 :   if (sym == NULL || sym->attr.flavor != FL_PROCEDURE || !sym->attr.is_bind_c)
    4221              :     return;
    4222              : 
    4223            0 :   for (f = sym->formal; f; f = f->next)
    4224              :     {
    4225            0 :       gfc_symbol *s;
    4226            0 :       s = f->sym;
    4227            0 :       if (s->as && (s->as->type == AS_ASSUMED_RANK || s->as->type == AS_ASSUMED_SHAPE))
    4228              :         {
    4229            0 :           *data_p = true;
    4230            0 :           return;
    4231              :         }
    4232              :     }
    4233              : }
    4234              : 
    4235              : static bool
    4236            0 : need_iso_fortran_binding ()
    4237              : {
    4238            0 :   bool needs_include = false;
    4239              : 
    4240            0 :   if (gfc_gsym_root == NULL)
    4241              :     return false;
    4242              : 
    4243            0 :   gfc_traverse_gsymbol (gfc_gsym_root, has_cfi_cdesc, (void *) &needs_include);
    4244            0 :   return needs_include;
    4245              : }
    4246              : 
    4247              : void
    4248            0 : gfc_dump_c_prototypes (FILE *file)
    4249              : {
    4250            0 :   bool bind_c = true;
    4251            0 :   int error_count;
    4252            0 :   gfc_namespace *ns;
    4253            0 :   gfc_get_errors (NULL, &error_count);
    4254            0 :   if (error_count != 0)
    4255            0 :     return;
    4256              : 
    4257            0 :   if (gfc_gsym_root == NULL)
    4258              :     return;
    4259              : 
    4260            0 :   dumpfile = file;
    4261            0 :   if (need_iso_fortran_binding ())
    4262            0 :     fputs ("#include <ISO_Fortran_binding.h>\n\n", dumpfile);
    4263              : 
    4264            0 :   for (ns = gfc_global_ns_list; ns; ns = ns->sibling)
    4265            0 :     gfc_traverse_ns (ns, write_type);
    4266              : 
    4267            0 :   gfc_traverse_gsymbol (gfc_gsym_root, show_external_symbol, (void *) &bind_c);
    4268              : }
    4269              : 
    4270              : /* Loop over all external symbols, writing out their declarations.  */
    4271              : 
    4272              : static bool seen_conflict;
    4273              : 
    4274              : void
    4275            0 : gfc_dump_external_c_prototypes (FILE * file)
    4276              : {
    4277            0 :   bool bind_c = false;
    4278            0 :   int error_count;
    4279              : 
    4280            0 :   gfc_get_errors (NULL, &error_count);
    4281            0 :   if (error_count != 0)
    4282            0 :     return;
    4283              : 
    4284            0 :   dumpfile = file;
    4285            0 :   seen_conflict = false;
    4286            0 :   fprintf (dumpfile,
    4287            0 :            _("/* Prototypes for external procedures generated from %s\n"
    4288              :              "   by GNU Fortran %s%s.\n\n"
    4289              :              "   Use of this interface is discouraged, consider using the\n"
    4290              :              "   BIND(C) feature of standard Fortran instead.  */\n\n"),
    4291              :            gfc_source_file, pkgversion_string, version_string);
    4292              : 
    4293            0 :   if (gfc_gsym_root == NULL)
    4294              :     return;
    4295              : 
    4296            0 :   gfc_traverse_gsymbol (gfc_gsym_root, show_external_symbol, (void *) &bind_c);
    4297            0 :   if (seen_conflict)
    4298            0 :     fprintf (dumpfile,
    4299            0 :              _("\n\n/* WARNING: Because of differing arguments to an external\n"
    4300              :                "   procedure, this header file is not compatible with -std=c23."
    4301              :                "\n\n   Use another -std option to compile.  */\n"));
    4302              : }
    4303              : 
    4304              : /* Callback function for dumping external symbols, be they BIND(C) or
    4305              :  external.  */
    4306              : 
    4307              : static void
    4308            0 : show_external_symbol (gfc_gsymbol *gsym, void *data)
    4309              : {
    4310            0 :   bool bind_c, *data_p;
    4311            0 :   gfc_symbol *sym;
    4312            0 :   const char *name;
    4313              : 
    4314            0 :   if (gsym->ns == NULL)
    4315            0 :     return;
    4316              : 
    4317            0 :   name = gsym->sym_name ? gsym->sym_name : gsym->name;
    4318              : 
    4319            0 :   gfc_find_symbol (name, gsym->ns, 0, &sym);
    4320            0 :   if (sym == NULL)
    4321              :     return;
    4322              : 
    4323            0 :   data_p = (bool *) data;
    4324            0 :   bind_c = *data_p;
    4325              : 
    4326            0 :   if (bind_c)
    4327              :     {
    4328            0 :       if (!sym->attr.is_bind_c)
    4329              :         return;
    4330              : 
    4331            0 :       write_interop_decl (sym);
    4332              :     }
    4333              :   else
    4334              :     {
    4335            0 :       if (sym->attr.flavor != FL_PROCEDURE || sym->attr.is_bind_c)
    4336              :         return;
    4337            0 :       write_proc (sym, false);
    4338              :     }
    4339              : }
    4340              : 
    4341              : enum type_return { T_OK=0, T_WARN, T_ERROR };
    4342              : 
    4343              : /* Return the name of the type for later output.  Both function pointers and
    4344              :    void pointers will be mapped to void *.  */
    4345              : 
    4346              : static enum type_return
    4347            0 : get_c_type_name (gfc_typespec *ts, gfc_array_spec *as, const char **pre,
    4348              :                  const char **type_name, bool *asterisk, const char **post,
    4349              :                  bool func_ret)
    4350              : {
    4351            0 :   static char post_buffer[40];
    4352            0 :   enum type_return ret;
    4353            0 :   ret = T_ERROR;
    4354              : 
    4355            0 :   *pre = " ";
    4356            0 :   *asterisk = false;
    4357            0 :   *post = "";
    4358            0 :   *type_name = "<error>";
    4359              : 
    4360            0 :   if (as && (as->type == AS_ASSUMED_RANK || as->type == AS_ASSUMED_SHAPE))
    4361              :     {
    4362            0 :       *asterisk = true;
    4363            0 :       *post = "";
    4364            0 :       *type_name = "CFI_cdesc_t";
    4365            0 :       return T_OK;
    4366              :     }
    4367              : 
    4368            0 :   if (ts->type == BT_REAL || ts->type == BT_INTEGER || ts->type == BT_COMPLEX
    4369              :       || ts->type == BT_UNSIGNED)
    4370              :     {
    4371            0 :       if (ts->is_c_interop && ts->interop_kind)
    4372              :         ret = T_OK;
    4373              :       else
    4374            0 :         ret = T_WARN;
    4375              : 
    4376            0 :       for (int i = 0; i < ISOCBINDING_NUMBER; i++)
    4377              :         {
    4378            0 :           if (c_interop_kinds_table[i].f90_type == ts->type
    4379            0 :               && c_interop_kinds_table[i].value == ts->kind)
    4380              :             {
    4381              :               /* Skip over 'c_'. */
    4382            0 :               *type_name = c_interop_kinds_table[i].name + 2;
    4383            0 :               if (strcmp (*type_name, "long_long") == 0)
    4384            0 :                 *type_name = "long long";
    4385            0 :               if (strcmp (*type_name, "long_double") == 0)
    4386            0 :                 *type_name = "long double";
    4387            0 :               if (strcmp (*type_name, "signed_char") == 0)
    4388            0 :                 *type_name = "signed char";
    4389            0 :               else if (strcmp (*type_name, "size_t") == 0)
    4390            0 :                 *type_name = "ssize_t";
    4391            0 :               else if (strcmp (*type_name, "float_complex") == 0)
    4392            0 :                 *type_name = "__GFORTRAN_FLOAT_COMPLEX";
    4393            0 :               else if (strcmp (*type_name, "double_complex") == 0)
    4394            0 :                 *type_name = "__GFORTRAN_DOUBLE_COMPLEX";
    4395            0 :               else if (strcmp (*type_name, "long_double_complex") == 0)
    4396            0 :                 *type_name = "__GFORTRAN_LONG_DOUBLE_COMPLEX";
    4397            0 :               else if (strcmp (*type_name, "unsigned") == 0)
    4398            0 :                 *type_name = "unsigned int";
    4399            0 :               else if (strcmp (*type_name, "unsigned_char") == 0)
    4400            0 :                 *type_name = "unsigned char";
    4401            0 :               else if (strcmp (*type_name, "unsigned_short") == 0)
    4402            0 :                 *type_name = "unsigned short int";
    4403            0 :               else if (strcmp (*type_name, "unsigned_long") == 0)
    4404            0 :                 *type_name = "unsigned long int";
    4405            0 :               else if (strcmp (*type_name, "unsigned_long long") == 0)
    4406            0 :                 *type_name = "unsigned long long int";
    4407              :               break;
    4408              :             }
    4409              :         }
    4410              :     }
    4411              :   else if (ts->type == BT_LOGICAL)
    4412              :     {
    4413            0 :       if (ts->is_c_interop && ts->interop_kind)
    4414              :         {
    4415            0 :           *type_name = "_Bool";
    4416            0 :           ret = T_OK;
    4417              :         }
    4418              :       else
    4419              :         {
    4420              :           /* Let's select an appropriate int, with a warning. */
    4421            0 :           for (int i = 0; i < ISOCBINDING_NUMBER; i++)
    4422              :             {
    4423            0 :               if (c_interop_kinds_table[i].f90_type == BT_INTEGER
    4424            0 :                   && c_interop_kinds_table[i].value == ts->kind)
    4425              :                 {
    4426            0 :                   *type_name = c_interop_kinds_table[i].name + 2;
    4427            0 :                   ret = T_WARN;
    4428              :                 }
    4429              :             }
    4430              :         }
    4431              :     }
    4432              :   else if (ts->type == BT_CHARACTER)
    4433              :     {
    4434            0 :       if (ts->is_c_interop)
    4435              :         {
    4436            0 :           *type_name = "char";
    4437            0 :           ret = T_OK;
    4438              :         }
    4439              :       else
    4440              :         {
    4441            0 :           if (ts->kind == gfc_default_character_kind)
    4442            0 :             *type_name = "char";
    4443              :           else
    4444              :             /* Let's select an appropriate int. */
    4445            0 :             for (int i = 0; i < ISOCBINDING_NUMBER; i++)
    4446              :               {
    4447            0 :                 if (c_interop_kinds_table[i].f90_type == BT_INTEGER
    4448            0 :                     && c_interop_kinds_table[i].value == ts->kind)
    4449              :                   {
    4450            0 :                     *type_name = c_interop_kinds_table[i].name + 2;
    4451            0 :                     break;
    4452              :                   }
    4453              :             }
    4454              :           ret = T_WARN;
    4455              : 
    4456              :         }
    4457              :     }
    4458              :   else if (ts->type == BT_DERIVED)
    4459              :     {
    4460            0 :       if (ts->u.derived->from_intmod == INTMOD_ISO_C_BINDING)
    4461              :         {
    4462            0 :           if (strcmp (ts->u.derived->name, "c_ptr") == 0)
    4463            0 :             *type_name = "void";
    4464            0 :           else if (strcmp (ts->u.derived->name, "c_funptr") == 0)
    4465              :             {
    4466            0 :               *type_name = "int ";
    4467            0 :               if (func_ret)
    4468              :                 {
    4469            0 :                   *pre = "(";
    4470            0 :                   *post = "())";
    4471              :                 }
    4472              :               else
    4473              :                 {
    4474            0 :                   *pre = "(";
    4475            0 :                   *post = ")()";
    4476              :                 }
    4477              :             }
    4478            0 :           *asterisk = true;
    4479            0 :           ret = T_OK;
    4480              :         }
    4481              :       else
    4482            0 :         *type_name = ts->u.derived->name;
    4483              : 
    4484              :       ret = T_OK;
    4485              :     }
    4486              : 
    4487            0 :   if (ret != T_ERROR && as && as->type == AS_EXPLICIT)
    4488              :     {
    4489            0 :       mpz_t sz;
    4490            0 :       bool size_ok;
    4491            0 :       size_ok = spec_size (as, &sz);
    4492            0 :       if (size_ok)
    4493              :         {
    4494            0 :           gmp_snprintf (post_buffer, sizeof(post_buffer), "[%Zd]", sz);
    4495            0 :           *post = post_buffer;
    4496            0 :           mpz_clear (sz);
    4497            0 :           *asterisk = false;
    4498              :         }
    4499              :       else
    4500            0 :         *asterisk = true;
    4501              :     }
    4502              :   return ret;
    4503              : }
    4504              : 
    4505              : /* Write out a declaration.  */
    4506              : 
    4507              : static void
    4508            0 : write_decl (gfc_typespec *ts, gfc_array_spec *as, const char *sym_name,
    4509              :             bool func_ret, locus *where, bool bind_c)
    4510              : {
    4511            0 :   const char *pre, *type_name, *post;
    4512            0 :   bool asterisk;
    4513            0 :   enum type_return rok;
    4514              : 
    4515            0 :   rok = get_c_type_name (ts, as, &pre, &type_name, &asterisk, &post, func_ret);
    4516            0 :   if (rok == T_ERROR)
    4517              :     {
    4518            0 :       gfc_error_now ("Cannot convert %qs to interoperable type at %L",
    4519              :                      gfc_typename (ts), where);
    4520            0 :       fprintf (dumpfile, "/* Cannot convert '%s' to interoperable type */",
    4521              :                gfc_typename (ts));
    4522            0 :       return;
    4523              :     }
    4524            0 :   fputs (type_name, dumpfile);
    4525            0 :   fputs (pre, dumpfile);
    4526            0 :   if (asterisk)
    4527            0 :     fputs ("*", dumpfile);
    4528              : 
    4529            0 :   fputs (sym_name, dumpfile);
    4530            0 :   fputs (post, dumpfile);
    4531              : 
    4532            0 :   if (rok == T_WARN && bind_c)
    4533            0 :     fprintf (dumpfile," /* WARNING: Converting '%s' to interoperable type */",
    4534              :              gfc_typename (ts));
    4535              : }
    4536              : 
    4537              : /* Write out an interoperable type.  It will be written as a typedef
    4538              :    for a struct.  */
    4539              : 
    4540              : static void
    4541            0 : write_type (gfc_symbol *sym)
    4542              : {
    4543            0 :   gfc_component *c;
    4544              : 
    4545              :   /* Don't dump types that are not interoperable, our very own ISO C Binding
    4546              :      module, or vtypes.  */
    4547              : 
    4548            0 :   if (sym->from_intmod == INTMOD_ISO_C_BINDING || sym->attr.flavor != FL_DERIVED
    4549            0 :       || sym->attr.vtype || !sym->attr.is_bind_c)
    4550              :     return;
    4551              : 
    4552            0 :   fprintf (dumpfile, "typedef struct %s {\n", sym->name);
    4553            0 :   for (c = sym->components; c; c = c->next)
    4554              :     {
    4555            0 :       fputs ("    ", dumpfile);
    4556            0 :       write_decl (&(c->ts), c->as, c->name, false, &sym->declared_at, true);
    4557            0 :       fputs (";\n", dumpfile);
    4558              :     }
    4559              : 
    4560            0 :   fprintf (dumpfile, "} %s;\n\n", sym->name);
    4561              : }
    4562              : 
    4563              : /* Write out a variable.  */
    4564              : 
    4565              : static void
    4566            0 : write_variable (gfc_symbol *sym)
    4567              : {
    4568            0 :   const char *sym_name;
    4569              : 
    4570            0 :   gcc_assert (sym->attr.flavor == FL_VARIABLE);
    4571              : 
    4572            0 :   if (sym->binding_label)
    4573              :     sym_name = sym->binding_label;
    4574              :   else
    4575            0 :     sym_name = sym->name;
    4576              : 
    4577            0 :   fputs ("extern ", dumpfile);
    4578            0 :   write_decl (&(sym->ts), sym->as, sym_name, false, &sym->declared_at, true);
    4579            0 :   fputs (";\n", dumpfile);
    4580            0 : }
    4581              : 
    4582              : static void
    4583            0 : write_formal_arglist (gfc_symbol *sym, bool bind_c)
    4584              : {
    4585            0 :   gfc_formal_arglist *f;
    4586              : 
    4587            0 :   if (sym->ts.interface)
    4588            0 :     f = sym->ts.interface->formal;
    4589              :   else
    4590            0 :     f = sym->formal;
    4591              : 
    4592            0 :   for (; f != NULL; f = f->next)
    4593              :     {
    4594            0 :       enum type_return rok;
    4595            0 :       const char *intent_in;
    4596            0 :       gfc_symbol *s;
    4597            0 :       const char *pre, *type_name, *post;
    4598            0 :       bool asterisk;
    4599              : 
    4600            0 :       s = f->sym;
    4601            0 :       rok = get_c_type_name (&(s->ts), s->as, &pre, &type_name, &asterisk,
    4602              :                              &post, false);
    4603              :       /* Procedure arguments have to be converted to function pointers.  */
    4604            0 :       if (s->attr.subroutine)
    4605              :         {
    4606            0 :           fprintf (dumpfile, "void (*%s) (", s->name);
    4607            0 :           if (s->ext_dummy_arglist_mismatch)
    4608            0 :             seen_conflict = true;
    4609              :           else
    4610            0 :             write_formal_arglist (s, bind_c);
    4611              : 
    4612            0 :           fputc (')', dumpfile);
    4613            0 :           goto next;
    4614              :         }
    4615              : 
    4616            0 :       if (rok == T_ERROR)
    4617              :         {
    4618            0 :           gfc_error_now ("Cannot convert %qs to interoperable type at %L",
    4619              :                          gfc_typename (&s->ts), &s->declared_at);
    4620            0 :           fprintf (dumpfile, "/* Cannot convert '%s' to interoperable type */",
    4621              :                    gfc_typename (&s->ts));
    4622            0 :           return;
    4623              :         }
    4624              : 
    4625            0 :       if (s->attr.function)
    4626              :         {
    4627            0 :           fprintf (dumpfile, "%s (*%s) (", type_name, s->name);
    4628            0 :           if (s->ext_dummy_arglist_mismatch)
    4629            0 :             seen_conflict = true;
    4630              :           else
    4631            0 :             write_formal_arglist (s, bind_c);
    4632              : 
    4633            0 :           fputc (')',dumpfile);
    4634            0 :           goto next;
    4635              :         }
    4636              : 
    4637              :       /* For explicit arrays, we already set the asterisk above.  */
    4638            0 :       if (!s->attr.value && !(s->as && s->as->type == AS_EXPLICIT))
    4639            0 :         asterisk = true;
    4640              : 
    4641            0 :       if (s->attr.intent == INTENT_IN && !s->attr.value)
    4642              :         intent_in = "const ";
    4643              :       else
    4644            0 :         intent_in = "";
    4645              : 
    4646            0 :       fputs (intent_in, dumpfile);
    4647            0 :       fputs (type_name, dumpfile);
    4648            0 :       fputs (pre, dumpfile);
    4649            0 :       if (asterisk)
    4650            0 :         fputs ("*", dumpfile);
    4651              : 
    4652            0 :       fputs (s->name, dumpfile);
    4653            0 :       fputs (post, dumpfile);
    4654            0 :       if (bind_c && rok == T_WARN)
    4655            0 :         fputs(" /* WARNING: non-interoperable KIND */ ", dumpfile);
    4656              : 
    4657            0 :     next:
    4658            0 :       if (f->next)
    4659            0 :         fputs(", ", dumpfile);
    4660              :     }
    4661            0 :   if (!bind_c)
    4662            0 :     for (f = sym->formal; f; f = f->next)
    4663            0 :       if (f->sym->ts.type == BT_CHARACTER)
    4664            0 :         fprintf (dumpfile, ", size_t %s_len", f->sym->name);
    4665              : 
    4666              : }
    4667              : 
    4668              : /* Write out an interoperable function returning a function pointer.  Better
    4669              :    handled separately.  As we know nothing about the type, assume void.
    4670              :    Function ponters can be freely converted in C anyway.  */
    4671              : 
    4672              : static void
    4673            0 : write_funptr_fcn (gfc_symbol *sym)
    4674              : {
    4675            0 :   fprintf (dumpfile, "void (*%s (", sym->binding_label);
    4676            0 :   write_formal_arglist (sym, 1);
    4677            0 :   fputs (")) ();\n", dumpfile);
    4678            0 : }
    4679              : 
    4680              : /* Write out a procedure, including its arguments.  */
    4681              : static void
    4682            0 : write_proc (gfc_symbol *sym, bool bind_c)
    4683              : {
    4684            0 :   const char *sym_name;
    4685            0 :   bool external_character;
    4686              : 
    4687            0 :   external_character =  sym->ts.type == BT_CHARACTER && !bind_c;
    4688              : 
    4689            0 :   if (sym->binding_label)
    4690              :     sym_name = sym->binding_label;
    4691              :   else
    4692            0 :     sym_name = sym->name;
    4693              : 
    4694            0 :   if (sym->ts.type == BT_UNKNOWN || external_character)
    4695              :     {
    4696            0 :       fprintf (dumpfile, "void ");
    4697            0 :       fputs (sym_name, dumpfile);
    4698              :     }
    4699              :   else
    4700            0 :     write_decl (&(sym->ts), sym->as, sym_name, true, &sym->declared_at, bind_c);
    4701              : 
    4702            0 :   if (!bind_c)
    4703            0 :     fputs ("_", dumpfile);
    4704              : 
    4705            0 :   fputs (" (", dumpfile);
    4706            0 :   if (external_character)
    4707              :     {
    4708            0 :       fprintf (dumpfile, "char *result_%s, size_t result_%s_len",
    4709              :                sym_name, sym_name);
    4710            0 :       if (sym->formal)
    4711            0 :         fputs (", ", dumpfile);
    4712              :     }
    4713            0 :   write_formal_arglist (sym, bind_c);
    4714            0 :   fputs (");\n", dumpfile);
    4715            0 : }
    4716              : 
    4717              : 
    4718              : /* Write a C-interoperable declaration as a C prototype or extern
    4719              :    declaration.  */
    4720              : 
    4721              : static void
    4722            0 : write_interop_decl (gfc_symbol *sym)
    4723              : {
    4724              :   /* Only dump bind(c) entities.  */
    4725            0 :   if (!sym->attr.is_bind_c)
    4726              :     return;
    4727              : 
    4728              :   /* Don't dump our iso c module.  */
    4729            0 :   if (sym->from_intmod == INTMOD_ISO_C_BINDING)
    4730              :     return;
    4731              : 
    4732            0 :   if (sym->attr.flavor == FL_VARIABLE)
    4733            0 :     write_variable (sym);
    4734            0 :   else if (sym->attr.flavor == FL_DERIVED)
    4735            0 :     write_type (sym);
    4736            0 :   else if (sym->attr.flavor == FL_PROCEDURE)
    4737              :     {
    4738            0 :       if (sym->ts.type == BT_DERIVED
    4739            0 :           && sym->ts.u.derived->intmod_sym_id == ISOCBINDING_FUNPTR)
    4740            0 :         write_funptr_fcn (sym);
    4741              :       else
    4742            0 :         write_proc (sym, true);
    4743              :     }
    4744              : }
    4745              : 
    4746              : /* This section deals with dumping the global symbol tree.  */
    4747              : 
    4748              : /* Callback function for printing out the contents of the tree.  */
    4749              : 
    4750              : static void
    4751            0 : show_global_symbol (gfc_gsymbol *gsym, void *f_data)
    4752              : {
    4753            0 :   FILE *out;
    4754            0 :   out = (FILE *) f_data;
    4755              : 
    4756            0 :   if (gsym->name)
    4757            0 :     fprintf (out, "name=%s", gsym->name);
    4758              : 
    4759            0 :   if (gsym->sym_name)
    4760            0 :     fprintf (out, ", sym_name=%s", gsym->sym_name);
    4761              : 
    4762            0 :   if (gsym->mod_name)
    4763            0 :     fprintf (out, ", mod_name=%s", gsym->mod_name);
    4764              : 
    4765            0 :   if (gsym->binding_label)
    4766            0 :     fprintf (out, ", binding_label=%s", gsym->binding_label);
    4767              : 
    4768            0 :   fputc ('\n', out);
    4769            0 : }
    4770              : 
    4771              : /* Show all global symbols.  */
    4772              : 
    4773              : void
    4774            0 : gfc_dump_global_symbols (FILE *f)
    4775              : {
    4776            0 :   if (gfc_gsym_root == NULL)
    4777            0 :     fprintf (f, "empty\n");
    4778              :   else
    4779            0 :     gfc_traverse_gsymbol (gfc_gsym_root, show_global_symbol, (void *) f);
    4780            0 : }
    4781              : 
    4782              : /* Show an array ref.  */
    4783              : 
    4784              : DEBUG_FUNCTION void
    4785            0 : debug (gfc_array_ref *ar)
    4786              : {
    4787            0 :   FILE *tmp = dumpfile;
    4788            0 :   dumpfile = stderr;
    4789            0 :   show_array_ref (ar);
    4790            0 :   fputc ('\n', dumpfile);
    4791            0 :   dumpfile = tmp;
    4792            0 : }
    4793              : 
    4794              : /* Dump OpenMP data structures.  */
    4795              : 
    4796              : DEBUG_FUNCTION void
    4797            0 : debug (gfc_omp_namelist *n)
    4798              : {
    4799            0 :   FILE *tmp = dumpfile;
    4800            0 :   dumpfile = stderr;
    4801            0 :   show_omp_namelist (OMP_LIST_MAP, n);
    4802            0 :   fputc ('\n', dumpfile);
    4803            0 :   dumpfile = tmp;
    4804            0 : }
    4805              : 
    4806              : DEBUG_FUNCTION void
    4807            0 : debug (gfc_omp_clauses *clauses)
    4808              : {
    4809            0 :   FILE *tmp = dumpfile;
    4810            0 :   dumpfile = stderr;
    4811            0 :   show_omp_clauses (clauses);
    4812            0 :   fputc ('\n', dumpfile);
    4813            0 :   dumpfile = tmp;
    4814            0 : }
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.