public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: FX Coudert <fxcoudert@gmail.com>
To: "fortran@gcc.gnu.org List" <fortran@gcc.gnu.org>,
	 gcc-patches list <gcc-patches@gcc.gnu.org>
Subject: [fortran,committed] Give Fortran-90-style names to intrinsic types
Date: Sun, 18 Nov 2007 13:06:00 -0000	[thread overview]
Message-ID: <76609E37-722B-446E-B976-34E133B24414@gmail.com> (raw)

Instead of naming the intrinsic types int4, logical4, real4, complex4  
and character, the patch above gives them a proper Fortran 90 name:  
integer(kind=4), ... and character(kind=1). This then shows up in gdb  
when inspecting the type of variables:

(gdb) ptype i
type = int(kind=4)
(gdb) ptype j
type = int(kind=8)
(gdb) ptype l
type = logical(kind=4)

This does not yet work for real and complex, because GDB ignores what  
we say there. (Time to make use of my new GDB copyright assignement!)

Regtested on x86_64-linux, committed (rev. 130261) as obvious after  
Jerry's approval on IRC.

FX



2007-11-17  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

         * trans-types.c (gfc_init_types): Use Fortran-90-style type
         names, with kinds.


Index: trans-types.c
===================================================================
--- trans-types.c       (revision 130234)
+++ trans-types.c       (working copy)
@@ -687,7 +687,7 @@ gfc_init_types (void)
      {
        type = gfc_build_int_type (&gfc_integer_kinds[index]);
        gfc_integer_types[index] = type;
-      snprintf (name_buf, sizeof(name_buf), "int%d",
+      snprintf (name_buf, sizeof(name_buf), "integer(kind=%d)",
                 gfc_integer_kinds[index].kind);
        PUSH_TYPE (name_buf, type);
      }
@@ -696,7 +696,7 @@ gfc_init_types (void)
      {
        type = gfc_build_logical_type (&gfc_logical_kinds[index]);
        gfc_logical_types[index] = type;
-      snprintf (name_buf, sizeof(name_buf), "logical%d",
+      snprintf (name_buf, sizeof(name_buf), "logical(kind=%d)",
                 gfc_logical_kinds[index].kind);
        PUSH_TYPE (name_buf, type);
      }
@@ -705,20 +705,20 @@ gfc_init_types (void)
      {
        type = gfc_build_real_type (&gfc_real_kinds[index]);
        gfc_real_types[index] = type;
-      snprintf (name_buf, sizeof(name_buf), "real%d",
+      snprintf (name_buf, sizeof(name_buf), "real(kind=%d)",
                 gfc_real_kinds[index].kind);
        PUSH_TYPE (name_buf, type);

        type = gfc_build_complex_type (type);
        gfc_complex_types[index] = type;
-      snprintf (name_buf, sizeof(name_buf), "complex%d",
+      snprintf (name_buf, sizeof(name_buf), "complex(kind=%d)",
                 gfc_real_kinds[index].kind);
        PUSH_TYPE (name_buf, type);
      }

    gfc_character1_type_node = build_type_variant  
(unsigned_char_type_node,
                                                  0, 0);
-  PUSH_TYPE ("char", gfc_character1_type_node);
+  PUSH_TYPE ("character(kind=1)", gfc_character1_type_node);

    PUSH_TYPE ("byte", unsigned_char_type_node);
    PUSH_TYPE ("void", void_type_node);

                 reply	other threads:[~2007-11-17 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=76609E37-722B-446E-B976-34E133B24414@gmail.com \
    --to=fxcoudert@gmail.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).