public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95998] New: gfc_typename use of static memory
@ 2020-07-08 12:17 dominiq at lps dot ens.fr
  2020-07-11 17:47 ` [Bug fortran/95998] " tkoenig at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-08 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-28 12:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 12:17 [Bug fortran/95998] New: gfc_typename use of static memory dominiq at lps dot ens.fr
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

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