public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/95998] New: gfc_typename use of static memory
Date: Wed, 08 Jul 2020 12:17:40 +0000	[thread overview]
Message-ID: <bug-95998-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 95998
           Summary: gfc_typename use of static memory
           Product: gcc
           Version: unknown
            Status: WAITING
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---
            Status: WAITING
  Last reconfirmed: 2020-07-08
    Ever confirmed: 1

The comment in misc.c says it all...

/* Return a string describing the type and kind of a typespec.  Because
   we return alternating buffers, this subroutine can appear twice in
   the argument list of a single statement.  */

Did we really audit our code to make sure we keep to this restriction? :-|

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Is static in C/C++ equivalent of SAVE in fortran (at least in the context of
gfc_typename)?

If yes, AFAIU the code the odd access to gfc_typename use buffer2, while even
ones
use buffer1? Wouldn't it be simple (safer?) to use only buffer1?

  static char buffer[GFC_MAX_SYMBOL_LEN + 7];  /* 7 for "TYPE()" + '\0'.  */
  gfc_typespec *ts1;
  gfc_charlen_t length = 0;

Same thing for gfc_dummy_typename, gfc_typename, ... .

             reply	other threads:[~2020-07-08 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 12:17 dominiq at lps dot ens.fr [this message]
2020-07-11 17:47 ` [Bug fortran/95998] " tkoenig at gcc dot gnu.org
2020-07-12  8:46 ` dominiq at lps dot ens.fr
2021-03-28 12:33 ` dominiq at lps dot ens.fr

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=bug-95998-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).