]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/55362 (ICE with size() on character pointer)
authorPaul Thomas <pault@gcc.gnu.org>
Sun, 10 Mar 2013 18:34:24 +0000 (18:34 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sun, 10 Mar 2013 18:34:24 +0000 (18:34 +0000)
2013-03-10  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/55362
* check.c (array_check): It is an error if a procedure is
passed.

2013-03-10  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/55362
* gfortran.dg/intrinsic_size_4.f90 : New test.

From-SVN: r196582

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

index c2a7a8b8ff0a017a5484d36b4a56cc5568669b51..1539ccef81faa95f9c2665f9eb6ae8d903f1adcc 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-10  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/55362
+       * check.c (array_check): It is an error if a procedure is
+       passed.
+
 2013-02-22  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/56385
index 32e54635005b517b3c6f1c12e93a2a455def3c12..d69ba886373818f0cc05f54afffb80c605ee39f3 100644 (file)
@@ -256,7 +256,7 @@ array_check (gfc_expr *e, int n)
       return SUCCESS;
     }
 
-  if (e->rank != 0)
+  if (e->rank != 0 && e->ts.type != BT_PROCEDURE)
     return SUCCESS;
 
   gfc_error ("'%s' argument of '%s' intrinsic at %L must be an array",
index 896b043b2eb882b400dc6238a926a7aae560eb60..e81622ae8a46e38aa73c5bdbf9fcdeb293c6a824 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-10  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/55362
+       * gfortran.dg/intrinsic_size_4.f90 : New test.
+
 2013-03-09  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/56534
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_size_4.f90 b/gcc/testsuite/gfortran.dg/intrinsic_size_4.f90
new file mode 100644 (file)
index 0000000..6d8e1c0
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! Test the fix for PR55362; the error below was missed and an ICE ensued.
+!
+! ! Contributed by Dominique d'Humieres  <dominiq@lps.ens.fr>
+!
+program ice_test
+  implicit none
+  write(*,*) 'message: ', &
+             size(Error_Msg),Error_Msg()     ! { dg-error "must be an array" }
+  write(*,*) 'message: ', &
+             size(Error_Msg ()),Error_Msg()  ! OK of course
+contains
+  function Error_Msg() result(ErrorMsg)
+    character, dimension(:), pointer :: ErrorMsg
+    character, dimension(1), target :: str = '!'
+    ErrorMsg => str
+  end function Error_Msg
+end program ice_test