[patches,fortran] Add POINTER INTENT(*) support (PR29624)
Tobias Burnus
burnus@net-b.de
Sun Dec 17 22:13:00 GMT 2006
Hi,
modified patch; the change in resolve_deallocate_exp caused the
following regression:
deallocate(pointerToArray(0))
was accepted, which provoked later an ICE. With the following change
(interdiff) this it detected. I added also a check to the test suite to
make sure this does not happen again.
Regression tested on x86_64-unknown-linux-gnu.
Tobias
INTERDIFF:
diff -u gcc/fortran/resolve.c gcc/fortran/resolve.c
--- gcc/fortran/resolve.c (Arbeitskopie)
+++ gcc/fortran/resolve.c (Arbeitskopie)
@@ -3317,6 +3317,7 @@
static try
resolve_deallocate_expr (gfc_expr * e)
{
+ symbol_attribute attr;
int allocatable, pointer, check_intent_in;
gfc_ref *ref;
@@ -3356,7 +3357,9 @@
}
}
- if (allocatable == 0 && pointer == 0)
+ attr = gfc_expr_attr (e);
+
+ if (allocatable == 0 && attr.pointer == 0)
{
bad:
gfc_error ("Expression in DEALLOCATE statement at %L must be "
only in patch2:
unchanged:
--- gcc/testsuite/gfortran.dg/alloc_alloc_expr_1.f90 (Revision 119989)
+++ gcc/testsuite/gfortran.dg/alloc_alloc_expr_1.f90 (Arbeitskopie)
@@ -24,6 +24,8 @@
ALLOCATE(PTR,ALLOCS(PTR)) ! { dg-error "same ALLOCATE statement" }
- print *, 'This program has three errors', PTR, ALLOC(1)
+ deallocate(ALLOCS(1)) ! { dg-error "must be ALLOCATABLE or a POINTER" }
+
+ print *, 'This program has four errors', PTR, ALLOC(1)
end program fc011
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pointer-intent2.diff
Type: text/x-patch
Size: 18574 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061217/23e8d1e9/attachment.bin>
More information about the Gcc-patches
mailing list