re PR fortran/49708 (ICE with allocate and no dimensions)
authorJanus Weil <janus@gcc.gnu.org>
Tue, 19 Jul 2011 12:38:59 +0000 (14:38 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Tue, 19 Jul 2011 12:38:59 +0000 (14:38 +0200)
2011-07-19  Janus Weil  <janus@gcc.gnu.org>

PR fortran/49708
* resolve.c (resolve_allocate_expr): Fix diagnostics for pointers.

2011-07-19  Janus Weil  <janus@gcc.gnu.org>

PR fortran/49708
* gfortran.dg/allocate_error_3.f90: New.

From-SVN: r176447

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

index a469ac9aa570fcdea147cccf386110803dc7a808..5d8cc6476c1c544de06356750b584937cb14e5ee 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-19  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/49708
+       * resolve.c (resolve_allocate_expr): Fix diagnostics for pointers.
+
 2011-07-18  Tobias Burnus  <burnus@net-b.de>
 
        * trans-decl.c (gfc_build_qualified_array): Make coarray's
index 53f45e85b8da84a52857df27550aa230ab3c7d46..71e0ba062f54d22a19d7fada3d77e13e5ce80f44 100644 (file)
@@ -6886,7 +6886,7 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
       gfc_find_derived_vtab (ts.u.derived);
     }
 
-  if (pointer || (dimension == 0 && codimension == 0))
+  if (dimension == 0 && codimension == 0)
     goto success;
 
   /* Make sure the last reference node is an array specifiction.  */
index d87ce8d7464e62f9f5ac4ddd7d981c5df51b4a36..4e77decb5b443da3b6ea3f99e9b6d69499570c5b 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-19  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/49708
+       * gfortran.dg/allocate_error_3.f90: New.
+
 2011-07-19  Richard Guenther  <rguenther@suse.de>
 
        * gcc.dg/tree-ssa/bool-10.c: Adjust expected pattern.
diff --git a/gcc/testsuite/gfortran.dg/allocate_error_3.f90 b/gcc/testsuite/gfortran.dg/allocate_error_3.f90
new file mode 100644 (file)
index 0000000..7616caa
--- /dev/null
@@ -0,0 +1,9 @@
+! { dg-do compile }
+!
+! PR 49708: [4.5/4.6/4.7 Regression] ICE with allocate and no dimensions
+!
+! Contributed by <fnordxyz@yahoo.com>
+
+  real, pointer :: x(:)
+  allocate(x)            ! { dg-error "Array specification required" }
+end