]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/34008 (ICE in gfc_trans_call, at fortran/trans-stmt.c:389 on elemental...
authorPaul Thomas <pault@gcc.gnu.org>
Fri, 16 Nov 2007 14:47:31 +0000 (14:47 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Fri, 16 Nov 2007 14:47:31 +0000 (14:47 +0000)
2007-11-16  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/34008
* trans-stmt.c (gfc_conv_elemental_dependencies): Add check for
INTENT_INOUT as well as INTENT_OUT.
(gfc_trans_call): Remove redundant gcc_asserts in dependency
check.

2007-11-16  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/34008
* gfortran.dg/interface_assignment_3.f90.

From-SVN: r130232

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

index 776b6520212af25d8617976e60dd9b019da88f53..fb94711be8a657e7859cb1c968c645333d6e69a5 100644 (file)
@@ -1,9 +1,24 @@
+2007-11-16  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/34008
+       * trans-stmt.c (gfc_conv_elemental_dependencies): Add check for
+       INTENT_INOUT as well as INTENT_OUT.
+       (gfc_trans_call): Remove redundant gcc_asserts in dependency
+       check.
+
 2007-11-16  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/33986
        * trans-array.c (gfc_conv_array_parameter ): Allow allocatable
        function results.
 
+2007-11-15  Tobias Burnus  <burnus@net-b.de>
+       PR fortran/33917
+       * decl.c (match_procedure_decl): Pre-resolve interface.
+       * resolve.c (resolve_symbol): Reject interfaces later
+       declared in procedure statements.
+
 2007-11-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/33162
index cbb15a5ce45af4b03b45d9f4ad0c461617d838ee..ee176dcb75d35112dac3d761b1191aeea8b2d01a 100644 (file)
@@ -246,8 +246,9 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
       fsym = formal ? formal->sym : NULL;
       if (e->expr_type == EXPR_VARIABLE
            && e->rank && fsym
-           && fsym->attr.intent == INTENT_OUT
-           && gfc_check_fncall_dependency (e, INTENT_OUT, sym, arg0))
+           && fsym->attr.intent != INTENT_IN
+           && gfc_check_fncall_dependency (e, fsym->attr.intent,
+                                           sym, arg0))
        {
          /* Make a local loopinfo for the temporary creation, so that
             none of the other ss->info's have to be renormalized.  */
@@ -380,14 +381,11 @@ gfc_trans_call (gfc_code * code, bool dependency_check)
       gfc_copy_loopinfo_to_se (&loopse, &loop);
       loopse.ss = ss;
 
-      /* For operator assignment, we need to do dependency checking.  
-        We also check the intent of the parameters.  */
+      /* For operator assignment, do dependency checking.  */
       if (dependency_check)
        {
          gfc_symbol *sym;
          sym = code->resolved_sym;
-         gcc_assert (sym->formal->sym->attr.intent == INTENT_OUT);
-         gcc_assert (sym->formal->next->sym->attr.intent == INTENT_IN);
          gfc_conv_elemental_dependencies (&se, &loopse, sym,
                                           code->ext.actual);
        }
index dc2c207a328d32836fde09425254ea41452a1bbb..a2a1caad18f08eb29b2948e9f239c0b877d2a683 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-16  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/34008
+       * gfortran.dg/interface_assignment_3.f90.
+
 2007-11-16  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/33870
diff --git a/gcc/testsuite/gfortran.dg/interface_assignment_3.f90 b/gcc/testsuite/gfortran.dg/interface_assignment_3.f90
new file mode 100644 (file)
index 0000000..6b7881b
--- /dev/null
@@ -0,0 +1,49 @@
+! { dg-do compile }
+! Checks the fix for PR34008, in which INTENT(INOUT) was disallowed
+! for the first argument of assign_m, whereas both INOUT and OUT
+! should be allowed.
+!
+! Contributed by Harald Anlauf <anlauf@gmx.de> 
+!
+module mo_memory
+  implicit none
+  type t_mi
+     logical       :: alloc = .false.
+  end type t_mi
+  type t_m
+     type(t_mi)    :: i                         ! meta data
+     real, pointer :: ptr (:,:,:,:) => NULL ()
+  end type t_m
+
+  interface assignment (=)
+     module  procedure assign_m
+  end interface
+contains
+  elemental subroutine assign_m (y, x)
+    !---------------------------------------
+    ! overwrite intrinsic assignment routine
+    !---------------------------------------
+    type (t_m), intent(inout) :: y
+    type (t_m), intent(in)    :: x
+    y% i = x% i
+    if (y% i% alloc) y% ptr = x% ptr
+  end subroutine assign_m
+end module mo_memory
+
+module gfcbug74
+  use mo_memory, only: t_m, assignment (=)
+  implicit none
+  type t_atm
+     type(t_m) :: m(42)
+  end type t_atm
+contains
+  subroutine assign_atm_to_atm (y, x)
+    type (t_atm), intent(inout) :: y
+    type (t_atm), intent(in)    :: x
+    integer :: i
+!   do i=1,42; y% m(i) = x% m(i); end do    ! Works
+    y% m = x% m                             ! ICE
+  end subroutine assign_atm_to_atm
+end module gfcbug74
+! { dg-final { cleanup-modules "mo_memory gfcbug74" } }
+