Index: gcc/fortran/resolve.c
===================================================================
*** gcc/fortran/resolve.c	(revision 205031)
--- gcc/fortran/resolve.c	(working copy)
*************** resolve_transfer (gfc_code *code)
*** 8247,8256 ****
  	 && exp->value.op.op == INTRINSIC_PARENTHESES)
      exp = exp->value.op.op1;
  
!   if (exp && exp->expr_type == EXPR_NULL && exp->ts.type == BT_UNKNOWN)
      {
!       gfc_error ("NULL intrinsic at %L in data transfer statement requires "
! 		 "MOLD=", &exp->where);
        return;
      }
  
--- 8247,8257 ----
  	 && exp->value.op.op == INTRINSIC_PARENTHESES)
      exp = exp->value.op.op1;
  
!   if (exp && exp->expr_type == EXPR_NULL
!       && code->ext.dt)
      {
!       gfc_error ("Invalid context for NULL () intrinsic at %L",
! 		 &exp->where);
        return;
      }
  
Index: gcc/testsuite/gfortran.dg/null_5.f90
===================================================================
*** gcc/testsuite/gfortran.dg/null_5.f90	(revision 205031)
--- gcc/testsuite/gfortran.dg/null_5.f90	(working copy)
*************** subroutine test_PR34547_1 ()
*** 34,40 ****
  end subroutine test_PR34547_1
  
  subroutine test_PR34547_2 ()
!   print *, null () ! { dg-error "in data transfer statement requires MOLD" }
  end subroutine test_PR34547_2
  
  subroutine test_PR34547_3 ()
--- 34,40 ----
  end subroutine test_PR34547_1
  
  subroutine test_PR34547_2 ()
!   print *, null () ! { dg-error "Invalid context" }
  end subroutine test_PR34547_2
  
  subroutine test_PR34547_3 ()
Index: gcc/testsuite/gfortran.dg/null_6.f90
===================================================================
*** gcc/testsuite/gfortran.dg/null_6.f90	(revision 205031)
--- gcc/testsuite/gfortran.dg/null_6.f90	(working copy)
*************** end subroutine test_PR50375_2
*** 30,34 ****
  
  subroutine test_PR34547_3 ()
    integer, allocatable :: i(:)
!   print *, NULL(i)
  end subroutine test_PR34547_3
--- 30,34 ----
  
  subroutine test_PR34547_3 ()
    integer, allocatable :: i(:)
!   print *, NULL(i)    ! { dg-error "Invalid context for NULL" }
  end subroutine test_PR34547_3

From-SVN: r205565
This commit is contained in:
Paul Thomas 2013-12-01 11:37:09 +00:00
parent c931d01d7d
commit 49560f0c74
5 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2013-12-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34547
* resolve.c (resolve_transfer): EXPR_NULL is always in an
invalid context in a transfer statement.
2013-11-28 Sergey Ostanevich <sergos.gnu@gmail.com>
* lang.opt (Wopenmp-simd): New.

View File

@ -8247,10 +8247,11 @@ resolve_transfer (gfc_code *code)
&& exp->value.op.op == INTRINSIC_PARENTHESES)
exp = exp->value.op.op1;
if (exp && exp->expr_type == EXPR_NULL && exp->ts.type == BT_UNKNOWN)
if (exp && exp->expr_type == EXPR_NULL
&& code->ext.dt)
{
gfc_error ("NULL intrinsic at %L in data transfer statement requires "
"MOLD=", &exp->where);
gfc_error ("Invalid context for NULL () intrinsic at %L",
&exp->where);
return;
}

View File

@ -1,3 +1,9 @@
2013-12-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34547
* gfortran.dg/null_5.f90 : Include new error.
* gfortran.dg/null_6.f90 : Include new error.
2013-11-29 Marek Polacek <polacek@redhat.com>
PR sanitizer/59331

View File

@ -34,7 +34,7 @@ subroutine test_PR34547_1 ()
end subroutine test_PR34547_1
subroutine test_PR34547_2 ()
print *, null () ! { dg-error "in data transfer statement requires MOLD" }
print *, null () ! { dg-error "Invalid context" }
end subroutine test_PR34547_2
subroutine test_PR34547_3 ()

View File

@ -30,5 +30,5 @@ end subroutine test_PR50375_2
subroutine test_PR34547_3 ()
integer, allocatable :: i(:)
print *, NULL(i)
print *, NULL(i) ! { dg-error "Invalid context for NULL" }
end subroutine test_PR34547_3