re PR fortran/48788 (ICE: SIGSEGV in resolve_global_procedure (resolve.c:2190) on...
authorTobias Burnus <burnus@net-b.de>
Wed, 27 Apr 2011 20:32:21 +0000 (22:32 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Wed, 27 Apr 2011 20:32:21 +0000 (22:32 +0200)
2011-04-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/48788
        * resolve.c (resolve_global_procedure): Error recovery -
        avoid segfault for (non)character-returning functions.

2011-04-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/48788
        * gfortran.dg/whole_file_34.f90: New.

From-SVN: r173048

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/whole_file_34.f90 [new file with mode: 0644]

index 78d687dbeedba2bae88fb4934b5cfdfa6856f94a..46df31889d79c3d66ea77cc8d189d1afe0de9cce 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-27  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/48788
+       * resolve.c (resolve_global_procedure): Error recovery -
+       avoid segfault for (non)character-returning functions.
+
 2011-04-26  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        * decl.c (gfc_match_end):  Check that the block name starts
index d7b95f51e1775b2bc414229e2e5f767d1674cc0c..144d3086650841035fc249c5bd12a20845164f7e 100644 (file)
@@ -2187,7 +2187,7 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
 
          /* F2003, 12.3.1.1 (3c); F2008, 12.4.2.2 (3c)  */
          if (sym->ts.type == BT_CHARACTER && sym->attr.if_source != IFSRC_IFBODY
-             && def_sym->ts.u.cl->length != NULL)
+             && def_sym->ts.type == BT_CHARACTER && def_sym->ts.u.cl->length != NULL)
            {
              gfc_charlen *cl = sym->ts.u.cl;
 
index a99f1c423ba96d5c9ee8d5a4c7c8428a89b2d7d5..d61af1b2568dab33746cb34d084ff7036c59ddf9 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-27  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/48788
+       * gfortran.dg/whole_file_34.f90: New.
+
 2011-04-27  Jan Hubicka  <jh@suse.cz>
 
        * gcc.dg/tree-ssa/inline-9.c: New testcase.
diff --git a/gcc/testsuite/gfortran.dg/whole_file_34.f90 b/gcc/testsuite/gfortran.dg/whole_file_34.f90
new file mode 100644 (file)
index 0000000..9b421e0
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+!
+! PR fortran/48788
+!
+! Contributed by Zdenek Sojka
+!
+function foo ()
+end function foo
+  character(4), external :: foo ! { dg-error "Return type mismatch of function" }
+  character(4) :: x
+  x = foo ()
+END