public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Roger Sayle <roger@nextmovesoftware.com>,
	<gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>
Subject: Re: [PATCH] gfortran: Respect target's NO_DOT_IN_LABEL in trans-common.cc
Date: Thu, 10 Feb 2022 11:39:24 +0100	[thread overview]
Message-ID: <e36e90a9-0d72-aa07-de66-c1b4415b1050@codesourcery.com> (raw)
In-Reply-To: <016801d81e66$10d48410$327d8c30$@nextmovesoftware.com>

On 10.02.22 11:07, Roger Sayle wrote:

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

In general, I think the patch is okay – but as '_' is a valid identifier
and with -fdollar-ok '$' is valid as well, I wonder whether there should
be a prefix and/or a capital letter. Namely:

+#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

The first one we want to keep as is for backwards compatibility. And
the '.' is fine in this regard. But I think for the other two, we need
to do more, e.g., '_Equiv' + '$%d' / '_%d'. The '_' and capital letter
should place everything into the compiler namespace (in terms of C/C++)
and Fortran itself requires for a name (case insensitive, lower cased by
gfortran): [A-Z][A-Z0-9_]* – thus, '_E' contains two characters not
accessible in a normal Fortran program (ignoring bind(C,name="...").

If the _Equiv[_$]%d sounds sensible to you: Please change; if not,
what concerns do you have?

> Ok for mainline?
OK with changing the prefix for the non-dot variant.

Tobias

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

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

      reply	other threads:[~2022-02-10 10:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 10:07 Roger Sayle
2022-02-10 10:39 ` Tobias Burnus [this message]

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=e36e90a9-0d72-aa07-de66-c1b4415b1050@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=roger@nextmovesoftware.com \
    /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).