From: "Roger Sayle" <roger@nextmovesoftware.com>
To: <gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>
Subject: [PATCH] gfortran: Respect target's NO_DOT_IN_LABEL in trans-common.cc
Date: Thu, 10 Feb 2022 10:07:50 -0000 [thread overview]
Message-ID: <016801d81e66$10d48410$327d8c30$@nextmovesoftware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]
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(!).
This patch has been tested on nvptx-none hosted by x86_64-pc-linux-gnu
with make and make -k check with no new failures, and the nine fewer
failures in the gfortran testsuite described above. Ok for mainline?
2022-02-10 Roger Sayle <roger@nextmovesoftware.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.
Thanks in advance,
Roger
--
[-- Attachment #2: patchf.txt --]
[-- Type: text/plain, Size: 914 bytes --]
diff --git a/gcc/fortran/trans-common.cc b/gcc/fortran/trans-common.cc
index 7b4d198..184a976 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;
next reply other threads:[~2022-02-10 10:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 10:07 Roger Sayle [this message]
2022-02-10 10:39 ` Tobias Burnus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='016801d81e66$10d48410$327d8c30$@nextmovesoftware.com' \
--to=roger@nextmovesoftware.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).