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

--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Mar 29, 2023 at 09:28:38PM +0000, pinskia at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109322
> 
> --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> There is a bug with -m32 and fc-prototypes though, it should be long long
> rather than long long. Let me provide a patch for that.
> 

This replaces '_' by ' ', but would certainly break if int_t
is in type_name.

diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 3b24bdc1a6c..3921adfbe01 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -3807,6 +3807,7 @@ write_decl (gfc_typespec *ts, gfc_array_spec *as, const
char *sym_name,
            bool func_ret, locus *where, bool bind_c)
 {
   const char *pre, *type_name, *post;
+  char *bp, buf[81];
   bool asterisk;
   enum type_return rok;

@@ -3819,7 +3820,15 @@ write_decl (gfc_typespec *ts, gfc_array_spec *as, const
char *sym_name,
               gfc_typename (ts));
       return;
     }
-  fputs (type_name, dumpfile);
+
+#if 1
+  bp = &buf[0];
+  strncpy(bp, type_name, 80);
+  for (; *bp != '\0'; bp++)
+    if (*bp == '_') *bp = ' ';
+#endif
+
+  fputs (buf, dumpfile);
   fputs (pre, dumpfile);
   if (asterisk)
     fputs ("*", dumpfile);

Reply via email to