public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* How do I print the name of a variable created with create_tmp_var_raw
@ 2020-12-08 18:34 Thomas Koenig
  2020-12-08 19:48 ` Tobias Burnus
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Koenig @ 2020-12-08 18:34 UTC (permalink / raw)
  To: gcc, fortran

Hi,

I would like to know the name of a variable created with
create_tmp_var_raw, but it is not clear to my how to do it.

gimple_decl_printable_name sounded like a likely candidate,
but that just returns a null pointer.  Any combination of
IDENTIFIER_POINTER and DECL_NAME that I tried also led to
checking errors or segfaults.

More specifically,

diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index f1c8f0ee17f..11043406840 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -96,7 +96,7 @@ gfc_create_var_np (tree type, const char *prefix)
    tree t;

    t = create_tmp_var_raw (type, prefix);
-
+  dprintf (2, "%s\n", IDENTIFIER_POINTER (DECL_NAME (t)));
    /* No warnings for anonymous variables.  */
    if (prefix == NULL)
      TREE_NO_WARNING (t) = 1;

which I thought should work according to the documentation I've
read resulted in a segfault.

Any pointers? Is there a magic incantation that I am missing?

Best regards

	Thomas

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

end of thread, other threads:[~2020-12-08 20:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 18:34 How do I print the name of a variable created with create_tmp_var_raw Thomas Koenig
2020-12-08 19:48 ` Tobias Burnus
2020-12-08 20:39   ` Thomas Koenig

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