public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7178] gfortran: Respect target's NO_DOT_IN_LABEL in trans-common.cc
@ 2022-02-10 13:33 Roger Sayle
  0 siblings, 0 replies; only message in thread
From: Roger Sayle @ 2022-02-10 13:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3881e1823c5a59d988ddcddcc1e25c5738e228fb

commit r12-7178-g3881e1823c5a59d988ddcddcc1e25c5738e228fb
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Thu Feb 10 13:32:07 2022 +0000

    gfortran: Respect target's NO_DOT_IN_LABEL in trans-common.cc
    
    This patch fixes 9 unexpected failures in the gfortran testsuite on
    nvptx-none.  The issue is that gfortran's EQUIVALENCE internally uses
    symbols such as "equiv.0" even on platforms that define NO_DOT_IN_LABEL.
    On nvptx-none, this then results in the following error message(s):
    ptxas application ptx input, fatal: Parsing error near '.0': syntax error
    ptxas fatal: Ptx assembly aborted due to errors
    
    The fix is to tweak trans-common.cc to respect the target's NO_DOT_IN_LABEL
    (and NO_DOLLAR_IN_LABEL) when generating internal equiv.%d symbols.
    Only the nvptx, mmix and xtensa backends define NO_DOT_IN_LABEL which
    explains why no-one has spotted/fixed this issue since the problematic
    code was last changed back in 2005(!).
    
    2022-02-10  Roger Sayle  <roger@nextmovesoftware.com>
                Tobias Burnus  <tobias@codesourcery.com>
    
    gcc/fortran/ChangeLog
            * trans-common.cc (GFC_EQUIV_FMT): New macro respecting the
            target's NO_DOT_IN_LABEL and NO_DOLLAR_IN_LABEL preferences.
            (build_equiv_decl): Use GFC_EQUIV_FMT here.

Diff:
---
 gcc/fortran/trans-common.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-common.cc b/gcc/fortran/trans-common.cc
index 7b4d1980c75..7c8cba0b2da 100644
--- a/gcc/fortran/trans-common.cc
+++ b/gcc/fortran/trans-common.cc
@@ -338,6 +338,13 @@ build_field (segment_info *h, tree union_type, record_layout_info rli)
   h->field = field;
 }
 
+#if !defined (NO_DOT_IN_LABEL)
+#define GFC_EQUIV_FMT "equiv.%d"
+#elif !defined (NO_DOLLAR_IN_LABEL)
+#define GFC_EQUIV_FMT "_Equiv$%d"
+#else
+#define GFC_EQUIV_FMT "_Equiv_%d"
+#endif
 
 /* Get storage for local equivalence.  */
 
@@ -356,7 +363,7 @@ build_equiv_decl (tree union_type, bool is_init, bool is_saved, bool is_auto)
       return decl;
     }
 
-  snprintf (name, sizeof (name), "equiv.%d", serial++);
+  snprintf (name, sizeof (name), GFC_EQUIV_FMT, serial++);
   decl = build_decl (input_location,
 		     VAR_DECL, get_identifier (name), union_type);
   DECL_ARTIFICIAL (decl) = 1;


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

only message in thread, other threads:[~2022-02-10 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 13:33 [gcc r12-7178] gfortran: Respect target's NO_DOT_IN_LABEL in trans-common.cc Roger Sayle

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