re PR fortran/82932 ([OOP] ICE in update_compcall_arglist, at fortran/resolve.c:5837)
authorJanus Weil <janus@gcc.gnu.org>
Sat, 11 Nov 2017 21:54:41 +0000 (22:54 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Sat, 11 Nov 2017 21:54:41 +0000 (22:54 +0100)
2017-11-11  Janus Weil  <janus@gcc.gnu.org>

PR fortran/82932
* resolve.c (update_compcall_arglist): Improve error recovery,
remove a gcc_assert.

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

PR fortran/82932
* gfortran.dg/typebound_call_29.f90: New test.

From-SVN: r254660

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

index 1e4348db255ddc51831a7bec3d8a86ccf3591c52..d766a4e56b6abd41aff0a6e4d74370be48fca462 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-11  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/82932
+       * resolve.c (update_compcall_arglist): Improve error recovery,
+       remove a gcc_assert.
+
 2017-11-10  Fritz Reese <fritzoreese@gmail.com>
 
        PR fortran/82886
index 1dde0d3ce1a63569cf98def63fdff48b4c0c1871..28a0c9e74b0e83fa0c1edd5c3cbebf0911fd7646 100644 (file)
@@ -5834,7 +5834,9 @@ update_compcall_arglist (gfc_expr* e)
       return true;
     }
 
-  gcc_assert (tbp->pass_arg_num > 0);
+  if (tbp->pass_arg_num <= 0)
+    return false;
+
   e->value.compcall.actual = update_arglist_pass (e->value.compcall.actual, po,
                                                  tbp->pass_arg_num,
                                                  tbp->pass_arg);
index d3e15cf7a00652cad47020e203ec88dbfd0b5264..4c739572756e98b2cd461fe74d1eaac44508f72e 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-11  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/82932
+       * gfortran.dg/typebound_call_29.f90: New test.
+
 2017-11-10  Fritz Reese <fritzoreese@gmail.com>
 
        PR fortran/82886
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_29.f90 b/gcc/testsuite/gfortran.dg/typebound_call_29.f90
new file mode 100644 (file)
index 0000000..b07e67f
--- /dev/null
@@ -0,0 +1,46 @@
+! { dg-do compile }
+!
+! PR 82932: [OOP] ICE in update_compcall_arglist, at fortran/resolve.c:5837
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+module m
+
+   implicit none
+
+   type, abstract :: AT
+   contains
+      procedure(init_ifc),    deferred :: sinit
+      procedure(missing_ifc), deferred :: missing
+      generic :: init    => sinit
+   end type
+
+   abstract interface
+      subroutine init_ifc(data)
+         import AT
+         class(AT) :: data
+      end subroutine
+      subroutine missing_ifc(data)
+         import AT
+         class(AT) :: data
+      end subroutine
+   end interface
+
+end module
+
+
+program p
+
+   use m
+
+   implicit none
+
+   type, extends(AT) :: ET  ! { dg-error "must be ABSTRACT" }
+   contains
+      procedure :: sinit
+   end type
+
+   type(ET) :: c
+   call c%init()
+
+end