public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/109624] New: dump-parse-tree prints attributes with unbalanced braces
@ 2023-04-25 17:26 aldot at gcc dot gnu.org
  2023-05-10 19:08 ` [Bug fortran/109624] " cvs-commit at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: aldot at gcc dot gnu.org @ 2023-04-25 17:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109624

            Bug ID: 109624
           Summary: dump-parse-tree prints attributes with unbalanced
                    braces
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: internal-improvement
          Severity: trivial
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aldot at gcc dot gnu.org
  Target Milestone: ---

(gdb) call debug(gfc_current_ns)

Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4)
procedure name = fmodule
  symtree: 'C_ptr'       || symbol: 'c_ptr'        
    type spec : (UNKNOWN 0)
    attributes: )
  symtree: '__def_init___iso_c_binding_C_ptr'|| symbol:
'__def_init___iso_c_binding_C_ptr' 
    type spec : (UNKNOWN 0)
    attributes: )
...

There is an open brace missing after "attributes: "

diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 1fc1f311e84..2380fa04796 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -125,6 +125,16 @@ void debug (gfc_ref *p)
   dumpfile = tmp;
 }

+void
+debug (gfc_namespace *ns)
+{
+  FILE *tmp = dumpfile;
+  dumpfile = stderr;
+  show_namespace (ns);
+  fputc ('\n', dumpfile);
+  dumpfile = tmp;
+}
+
 void
 gfc_debug_expr (gfc_expr *e)
 {
@@ -136,7 +146,6 @@ gfc_debug_expr (gfc_expr *e)
 }

 /* Allow for dumping of a piece of code in the debugger.  */
-void gfc_debug_code (gfc_code *c);

 void
 gfc_debug_code (gfc_code *c)
@@ -758,12 +767,13 @@ show_expr (gfc_expr *p)
 static void
 show_attr (symbol_attribute *attr, const char * module)
 {
+  fputc ('(', dumpfile);
   if (attr->flavor != FL_UNKNOWN)
     {
       if (attr->flavor == FL_DERIVED && attr->pdt_template)
-       fputs (" (PDT-TEMPLATE", dumpfile);
+       fputs ("PDT-TEMPLATE ", dumpfile);
       else
-    fprintf (dumpfile, "(%s ", gfc_code2string (flavors, attr->flavor));
+       fprintf (dumpfile, "%s ", gfc_code2string (flavors, attr->flavor));
     }
   if (attr->access != ACCESS_UNKNOWN)
     fprintf (dumpfile, "%s ", gfc_code2string (access_types, attr->access));

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/109624] dump-parse-tree prints attributes with unbalanced braces
  2023-04-25 17:26 [Bug fortran/109624] New: dump-parse-tree prints attributes with unbalanced braces aldot at gcc dot gnu.org
@ 2023-05-10 19:08 ` cvs-commit at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-10 19:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109624

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Bernhard Reutner-Fischer
<aldot@gcc.gnu.org>:

https://gcc.gnu.org/g:39f7c0963a9c009e6c9b98e95dbba31cccb07329

commit r14-664-g39f7c0963a9c009e6c9b98e95dbba31cccb07329
Author: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Date:   Tue May 9 17:21:16 2023 +0200

    Fortran: dump-parse-tree attribs: fix unbalanced braces [PR109624]

    gcc/fortran/ChangeLog:

            PR fortran/109624
            * dump-parse-tree.cc (debug): New function for gfc_namespace.
            (gfc_debug_code): Delete forward declaration.
            (show_attr): Make sure to print balanced braces.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-10 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 17:26 [Bug fortran/109624] New: dump-parse-tree prints attributes with unbalanced braces aldot at gcc dot gnu.org
2023-05-10 19:08 ` [Bug fortran/109624] " cvs-commit at gcc dot gnu.org

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).