]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2019-06-20 Thomas Koenig <tkoenig@gcc.gnu.org>
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Jun 2019 11:56:50 +0000 (11:56 +0000)
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Jun 2019 11:56:50 +0000 (11:56 +0000)
PR fortran/90937
* trans-types.c (get_formal_from_actual_arglist): Get symbol from
current namespace so it will be freed later.  If symbol is of type
character, get an empty character length.

2019-06-20  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/90937
* gfortran.dg/external_procedure_4.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272506 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-types.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/external_procedure_4.f90 [new file with mode: 0644]

index bf54e29271b3833f4c9b147bf7027897f7778247..30bf112bdabe74076e771cd98ddff5f2f4afe8c6 100644 (file)
@@ -1,7 +1,14 @@
+2019-06-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/90937
+       * trans-types.c (get_formal_from_actual_arglist): Get symbol from
+       current namespace so it will be freed later.  If symbol is of type
+       character, get an empty character length.
+
 2019-06-19  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/69499
-       * match.c (gfc_match_select_type):  SELECT TYPE is an executable 
+       * match.c (gfc_match_select_type):  SELECT TYPE is an executable
        statement, and cannot appear in MODULE or SUBMODULE scope.
 
 2019-06-19  Steven G. Kargl  <kargl@gcc.gnu.org>
@@ -18,7 +25,7 @@
 
 2019-06-19  Jim MacArthur  <jim.macarthur@codethink.co.uk>
            Mark Eggleston  <mark.eggleston@codethink.com>
-       
+
        PR fortran/89103
        * gfortran.texi: Add -fdec-blank-format-item
        * invoke.texi: Add option to list of options.
 
        PR fortran/90002
        * array.c (gfc_free_array_spec): When freeing an array-spec, avoid
-       an ICE for assumed-shape coarrays 
+       an ICE for assumed-shape coarrays.
 
 2019-06-08  Paul Thomas  <pault@gcc.gnu.org>
 
index d236f37be6d679fefb121e8adc70014f59650991..1dbb842a1c417906e5f9b961e85eeb84beea2a32 100644 (file)
@@ -2997,7 +2997,7 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args
       if (a->expr)
        {
          snprintf (name, GFC_MAX_SYMBOL_LEN, "_formal_%d", var_num ++);
-         gfc_get_symbol (name, NULL, &s);
+         gfc_get_symbol (name, gfc_current_ns, &s);
          if (a->expr->ts.type == BT_PROCEDURE)
            {
              s->attr.flavor = FL_PROCEDURE;
@@ -3005,6 +3005,10 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args
          else
            {
              s->ts = a->expr->ts;
+
+             if (s->ts.type == BT_CHARACTER)
+                 s->ts.u.cl = gfc_get_charlen ();
+
              s->ts.deferred = 0;
              s->ts.is_iso_c = 0;
              s->ts.is_c_interop = 0;
index 50a0feacbfdf7f7251d8cfcd0d38f9b37fc49d79..c91f8ed98a252d12e2ba49719675f7007c1bd0b1 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/90937
+       * gfortran.dg/external_procedure_4.f90: New test.
+
 2019-06-20  Tom de Vries  <tdevries@suse.de>
 
        * gcc.dg/pr90866-2.c: Require global_constructor.
        PR fortran/89103
        * gfortran.dg/dec_format_empty_item_1.f: New test.
        * gfortran.dg/dec_format_empty_item_2.f: New test.
-       * gfortran.dg/dec_format_empty_item_3.f: New test. 
+       * gfortran.dg/dec_format_empty_item_3.f: New test.
 
 2019-06-19  Kugan Vivekanandarajah  <kugan.vivekanandarajah@linaro.org>
 
diff --git a/gcc/testsuite/gfortran.dg/external_procedure_4.f90 b/gcc/testsuite/gfortran.dg/external_procedure_4.f90
new file mode 100644 (file)
index 0000000..403f173
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! PR fortran/90937 - this used to cause an ICE.
+! Original test case by Toon Moene.
+subroutine lfidiff
+
+   implicit none
+
+   contains 
+
+      subroutine grlfi(cdnom)
+
+         character(len=*) cdnom(:)
+         character(len=len(cdnom)) clnoma
+
+         call lficas(clnoma)
+
+      end subroutine grlfi
+
+end subroutine lfidiff