Fortran: dump-parse-tree.c fixes for OpenMP

Message ID
State New
Headers show
  • Fortran: dump-parse-tree.c fixes for OpenMP
Related show

Commit Message

Tobias Burnus Oct. 13, 2021, 8:44 a.m.
I recently saw that 'ancestor:' wasn't handled in -fdump-parse-tree.
I also did run once into an ICE for the swap flag in atomics when
dumping. – This fixes the two.

Additionally, I changed 'ancestor' to a bit field.

Comments? If not, I will commit it later today.

Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955


Fortran: dump-parse-tree.c fixes for OpenMP


	* dump-parse-tree.c (show_omp_clauses): Handle ancestor modifier,
	* gfortran.h (gfc_omp_clauses): Change 'anecestor' into a bitfield.

diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c
index 64e04c043f6..14a307856fc 100644
--- a/gcc/fortran/dump-parse-tree.c
+++ b/gcc/fortran/dump-parse-tree.c
@@ -1750,6 +1750,8 @@  show_omp_clauses (gfc_omp_clauses *omp_clauses)
   if (omp_clauses->device)
       fputs (" DEVICE(", dumpfile);
+      if (omp_clauses->ancestor)
+	fputs ("ANCESTOR:", dumpfile);
       show_expr (omp_clauses->device);
       fputc (')', dumpfile);
@@ -1894,7 +1896,7 @@  show_omp_clauses (gfc_omp_clauses *omp_clauses)
   if (omp_clauses->atomic_op != GFC_OMP_ATOMIC_UNSET)
       const char *atomic_op;
-      switch (omp_clauses->atomic_op)
+      switch (omp_clauses->atomic_op & GFC_OMP_ATOMIC_MASK)
 	case GFC_OMP_ATOMIC_READ: atomic_op = "READ"; break;
 	case GFC_OMP_ATOMIC_WRITE: atomic_op = "WRITE"; break;
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index c25d1cca3a8..b2b0254a3c3 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1482,12 +1482,11 @@  typedef struct gfc_omp_clauses
   struct gfc_expr *dist_chunk_size;
   struct gfc_expr *message;
   const char *critical_name;
-  bool ancestor;
   enum gfc_omp_default_sharing default_sharing;
   enum gfc_omp_atomic_op atomic_op;
   enum gfc_omp_defaultmap defaultmap[OMP_DEFAULTMAP_CAT_NUM];
   int collapse, orderedc;
-  unsigned nowait:1, ordered:1, untied:1, mergeable:1;
+  unsigned nowait:1, ordered:1, untied:1, mergeable:1, ancestor:1;
   unsigned inbranch:1, notinbranch:1, nogroup:1;
   unsigned sched_simd:1, sched_monotonic:1, sched_nonmonotonic:1;
   unsigned simd:1, threads:1, depend_source:1, destroy:1, order_concurrent:1;