]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Index...
authorPaul Thomas <pault@gcc.gnu.org>
Sun, 1 Dec 2013 11:37:09 +0000 (11:37 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sun, 1 Dec 2013 11:37:09 +0000 (11:37 +0000)
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

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/null_5.f90
gcc/testsuite/gfortran.dg/null_6.f90

index 124a45894f09f6da75a102143680d4b0ef3cfce8..b01b84b8477eafd4160abb9628da7b1c4e0fbdd8 100644 (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.
index 4befb9fdda411fd389a62b5657058a6c46832ba2..d16347d034e212fbcdecb48ee2d42363907476a0 100644 (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;
     }
 
index bad1f9273812f62fecf481e4461629dbf728de1d..b63f3de2484264159decae2988be4e7e9b5c104e 100644 (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
index 886a6a1ff8bbcc1f0d8d73a824df14cf8ff9eb16..50b41c3e8bf63ac19eab366e7f869b2d3c0d6749 100644 (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 ()
index dd517cfa3e2b3bfd5a068925bc653e2e19556c8a..6b8f21e63bc15d4edcb7f5f0f386812685e4c852 100644 (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