public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/redhat/heads/gcc-10-branch)] Allow concatenated module+submodule names.
Date: Thu, 30 Jan 2020 20:56:00 -0000	[thread overview]
Message-ID: <20200130205514.89706.qmail@sourceware.org> (raw)

https://gcc.gnu.org/g:a83b5cc5828ee34471de415e8893242dd3b0a91b

commit a83b5cc5828ee34471de415e8893242dd3b0a91b
Author: Andrew Benson <abenson@carnegiescience.edu>
Date:   Tue Jan 28 17:58:40 2020 +0000

    Allow concatenated module+submodule names.
    
    Increase length of char variables "parent1" and "parent2" in
    set_syms_host_assoc() to allow them to hold concatenated module +
    submodule names.
    
            PR fortran/93473
            * parse.c: Increase length of char variables to allow them to hold
            a concatenated module + submodule name.
            * gfortran.dg/pr93473.f90: New test.

Diff:
---
 gcc/fortran/ChangeLog                 |  7 +++++++
 gcc/fortran/parse.c                   |  5 +++--
 gcc/testsuite/gfortran.dg/pr93473.f90 | 28 ++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c7e2b31..3e8a24c 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-28  Andrew Benson  <abensonca@gmail.com>
+
+	PR fortran/93473
+	* parse.c: Increase length of char variables to allow them to hold
+	a concatenated module + submodule name.
+	* gfortran.dg/pr93473.f90: New test.
+
 2020-01-28  Julian Brown  <julian@codesourcery.com>
 
 	PR fortran/93025
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 4bff0c8..f71a95d 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -6045,8 +6045,9 @@ set_syms_host_assoc (gfc_symbol *sym)
 {
   gfc_component *c;
   const char dot[2] = ".";
-  char parent1[GFC_MAX_SYMBOL_LEN + 1];
-  char parent2[GFC_MAX_SYMBOL_LEN + 1];
+  /* Symbols take the form module.submodule_ or module.name_. */
+  char parent1[2 * GFC_MAX_SYMBOL_LEN + 2];
+  char parent2[2 * GFC_MAX_SYMBOL_LEN + 2];
 
   if (sym == NULL)
     return;
diff --git a/gcc/testsuite/gfortran.dg/pr93473.f90 b/gcc/testsuite/gfortran.dg/pr93473.f90
new file mode 100644
index 0000000..dda8525
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr93473.f90
@@ -0,0 +1,28 @@
+! { dg-do compile }
+! { dg-options "-ffree-line-length-none" }
+! PR fortran/93473
+module aModestlyLongModuleName
+  
+  type :: aTypeWithASignificantlyLongNameButStillAllowedOK
+  end type aTypeWithASignificantlyLongNameButStillAllowedOK
+  
+  interface
+     module function aFunctionWithALongButStillAllowedName(parameters) result(self)
+       type(aTypeWithASignificantlyLongNameButStillAllowedOK) :: self
+     end function aFunctionWithALongButStillAllowedName
+  end interface
+  
+end module aModestlyLongModuleName
+
+submodule (aModestlyLongModuleName) aTypeWithASignificantlyLongNameButStillAllowedOK_
+
+contains
+
+  module procedure aFunctionWithALongButStillAllowedName
+     class(*), pointer :: genericObject
+  end procedure aFunctionWithALongButStillAllowedName
+
+end submodule aTypeWithASignificantlyLongNameButStillAllowedOK_
+
+submodule (aModestlyLongModuleName:aTypeWithASignificantlyLongNameButStillAllowedOK_) aSubmoduleWithASignificantlyLongButStillAllowedName__
+end submodule aSubmoduleWithASignificantlyLongButStillAllowedName__


                 reply	other threads:[~2020-01-30 20:56 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=20200130205514.89706.qmail@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@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).