re PR fortran/58471 (ICE on invalid with missing type constructor and -Wall)
authorJanus Weil <janus@gcc.gnu.org>
Thu, 7 Nov 2013 22:39:15 +0000 (23:39 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Thu, 7 Nov 2013 22:39:15 +0000 (23:39 +0100)
2013-11-07  Janus Weil  <janus@gcc.gnu.org>

PR fortran/58471
* primary.c (gfc_expr_attr): Check for result symbol.

2013-11-07  Janus Weil  <janus@gcc.gnu.org>

PR fortran/58471
* gfortran.dg/constructor_9.f90: New.

From-SVN: r204547

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

index c709621..8e2e10c 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-07  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/58471
+       * primary.c (gfc_expr_attr): Check for result symbol.
+
 2013-11-06  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        * gfortran.texi: Fix typo.
index 80d45ea..c9a26b0 100644 (file)
@@ -2258,7 +2258,7 @@ gfc_expr_attr (gfc_expr *e)
     case EXPR_FUNCTION:
       gfc_clear_attr (&attr);
 
-      if (e->value.function.esym != NULL)
+      if (e->value.function.esym && e->value.function.esym->result)
        {
          gfc_symbol *sym = e->value.function.esym->result;
          attr = sym->attr;
index 0e85081..e83d64e 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-07  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/58471
+       * gfortran.dg/constructor_9.f90: New.
+
 2013-11-07  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc.dg/atomic-compare-exchange-1.c,
diff --git a/gcc/testsuite/gfortran.dg/constructor_9.f90 b/gcc/testsuite/gfortran.dg/constructor_9.f90
new file mode 100644 (file)
index 0000000..5196703
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! { dg-options "-Wall" }
+!
+! PR 58471: [4.8/4.9 Regression] ICE on invalid with missing type constructor and -Wall
+!
+! Contributed by Andrew Benson <abensonca@gmail.com>
+
+module cf
+  implicit none
+  type :: cfmde
+  end type
+  interface cfmde
+     module procedure mdedc   ! { dg-error "is neither function nor subroutine" }
+  end interface
+contains
+  subroutine cfi()
+    type(cfmde), pointer :: cfd
+    cfd=cfmde()                  ! { dg-error "Can't convert" }
+  end subroutine
+end module
+
+! { dg-final { cleanup-modules "cf" } }