[Bug fortran/52652] call to gfc_match_asynchronous for allocatable at parse.c line 164

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 21 13:24:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52652

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-03-21
                 CC|                            |burnus at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-21 13:21:35 UTC ---
Confirmed - and well spotted. Thanks for the bug report!

 * * *

The code has been added for PR 25829 comment 16 (Rev. 155732), however, it
wasn't working before either - thus, it is not a regression. (I had an example
to test the parsing in the patch submittal - but as  I didn't use "allocate()"
it "successfully" compiled.)

 * * *

Test case: It's valid, but rejected with
  Error: Allocate-object at (1) is not a nonprocedure pointer
         or an allocatable variable


module m
  type t
  end type t
end module m

type(t) function bar()
  use m
  allocatable :: bar
  allocate (bar)
end

Untested patch:

--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -3574,4 +3574,4 @@ gfc_match_allocate (void)
        {
-         gfc_error ("Allocate-object at %L is not a nonprocedure pointer "
-                    "or an allocatable variable", &tail->expr->where);
+         gfc_error ("Allocate-object at %L is neither a nonprocedure pointer "
+                    "nor an allocatable variable", &tail->expr->where);
          goto cleanup;
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -163,3 +163,3 @@ decode_specification_statement (void)
             ST_INTERFACE);
-      match ("allocatable", gfc_match_asynchronous, ST_ATTR_DECL);
+      match ("allocatable", gfc_match_allocatable, ST_ATTR_DECL);
       match ("asynchronous", gfc_match_asynchronous, ST_ATTR_DECL);

--- a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90
@@ -27 +27 @@ program a
-  allocate(err) ! { dg-error "nonprocedure pointer or an allocatable" }
+  allocate(err) ! { dg-error "neither a nonprocedure pointer nor an
allocatable" }
--- a/gcc/testsuite/gfortran.dg/allocate_class_1.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_class_1.f90
@@ -10 +10 @@
- allocate(x)     ! { dg-error "is not a nonprocedure pointer or an allocatable
variable" }
+ allocate(x)     ! { dg-error "is neither a nonprocedure pointer nor an
allocatable variable" }
--- a/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90
@@ -24 +24 @@ subroutine not_an_f03_intrinsic
-   allocate(double complex :: d1) ! { dg-error "not a nonprocedure pointer or
an allocatable" }
+   allocate(double complex :: d1) ! { dg-error "neither a nonprocedure pointer
nor an allocatable" }
--- a/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90
+++ b/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90
@@ -27 +27 @@ program a
-  deallocate(err) ! { dg-error "nonprocedure pointer or an allocatable" }
+  deallocate(err) ! { dg-error "nonprocedure pointer nor an allocatable" }



More information about the Gcc-bugs mailing list