public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-13] Fortran: Fix parse-dump-tree for OpenMP ALLOCATE clause
@ 2023-10-26 14:14 Tobias Burnus
  0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2023-10-26 14:14 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7449921f6a002c4b1835122cd446b68877610ff0

commit 7449921f6a002c4b1835122cd446b68877610ff0
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Thu Oct 26 11:23:31 2023 +0200

    Fortran: Fix parse-dump-tree for OpenMP ALLOCATE clause
    
    Commit r14-1301-gd64e8e1224708e added u2.allocator to gfc_omp_namelist
    for better readability and to permit to use namelist->expr for code
    like the following:
      !$omp allocators allocate(align(32) : dt%alloc_comp)
        allocate (dt%alloc_comp(5))
      !$omp allocate(dt%alloc_comp2) align(64)
        allocate (dt%alloc_comp2(10))
    However, for the parse-tree dump the change was incomplete.
    
    gcc/fortran/ChangeLog:
    
            * dump-parse-tree.cc (show_omp_namelist): Fix dump of the allocator
            modifier of OMP_LIST_ALLOCATE.
    
    (cherry picked from commit 99e3214f582b08b69b11b53eb3fc73b0919ef4f1)

Diff:
---
 gcc/fortran/ChangeLog.omp      | 8 ++++++++
 gcc/fortran/dump-parse-tree.cc | 9 ++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 71098850548c..2181e2b86edc 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,11 @@
+2023-10-26  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backported from master:
+	2023-06-20  Tobias Burnus  <tobias@codesourcery.com>
+
+	* dump-parse-tree.cc (show_omp_namelist): Fix dump of the allocator
+	modifier of OMP_LIST_ALLOCATE.
+
 2023-10-26  Tobias Burnus  <tobias@codesourcery.com>
 	    Chung-Lin Tang  <cltang@codesourcery.com>
 
diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 14d5ebdbb850..38c944a9c7d3 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -1361,7 +1361,7 @@ show_omp_namelist (int list_type, gfc_omp_namelist *n)
 	}
       if (list_type == OMP_LIST_ALLOCATE)
 	{
-	  if (n->expr)
+	  if (n->u2.allocator)
 	    {
 	      fputs ("allocator(", dumpfile);
 	      show_expr (n->u2.allocator);
@@ -1375,9 +1375,12 @@ show_omp_namelist (int list_type, gfc_omp_namelist *n)
 	      show_expr (n->u.align);
 	      fputc (')', dumpfile);
 	    }
-	  if (n->expr || n->u.align)
+	  if (n->u2.allocator || n->u.align)
 	    fputc (':', dumpfile);
-	  fputs (n->sym->name, dumpfile);
+	  if (n->expr)
+	    show_expr (n->expr);
+	  else
+	    fputs (n->sym->name, dumpfile);
 	  if (n->next)
 	    fputs (") ALLOCATE(", dumpfile);
 	  continue;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-26 14:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26 14:14 [gcc/devel/omp/gcc-13] Fortran: Fix parse-dump-tree for OpenMP ALLOCATE clause Tobias Burnus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).