diff options
author | Asher Langton <langton2@llnl.gov> | 2011-06-02 21:36:02 +0000 |
---|---|---|
committer | Asher Langton <langton@gcc.gnu.org> | 2011-06-02 21:36:02 +0000 |
commit | 11126dc093925fdfebfb0d3f9eff60a75d5e5a23 (patch) | |
tree | 108be54edb097760783968d1949c5b72848873eb /gcc | |
parent | 4e76acd2f045e5a196a0351b1b445ce7ce18f4ca (diff) | |
download | gcc-11126dc093925fdfebfb0d3f9eff60a75d5e5a23.zip gcc-11126dc093925fdfebfb0d3f9eff60a75d5e5a23.tar.gz gcc-11126dc093925fdfebfb0d3f9eff60a75d5e5a23.tar.bz2 |
re PR fortran/37039 (Cray pointer with pointee DIMENSION statement after POINTER statement)
* decl.c (variable_decl): Merge current_as before copying to cp_as.
* gfortran.dg/PR37039.f90: New test.
From-SVN: r174582
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/PR37039.f90 | 15 |
4 files changed, 29 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e7b567e..fec047e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2011-06-02 Asher Langton <langton2@llnl.gov> + + PR fortran/37039 + * decl.c (variable_decl): Merge current_as before copying to cp_as. + 2011-06-02 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/49265 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index f914156..7098368 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1763,9 +1763,7 @@ variable_decl (int elem) /* Now we could see the optional array spec. or character length. */ m = gfc_match_array_spec (&as, true, true); - if (gfc_option.flag_cray_pointer && m == MATCH_YES) - cp_as = gfc_copy_array_spec (as); - else if (m == MATCH_ERROR) + if (m == MATCH_ERROR) goto cleanup; if (m == MATCH_NO) @@ -1773,6 +1771,9 @@ variable_decl (int elem) else if (current_as) merge_array_spec (current_as, as, true); + if (gfc_option.flag_cray_pointer) + cp_as = gfc_copy_array_spec (as); + /* At this point, we know for sure if the symbol is PARAMETER and can thus determine (and check) whether it can be implied-shape. If it was parsed as assumed-size, change it because PARAMETERs can not diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c6c4b06..2a45ec1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-06-02 Asher Langton <langton2@llnl.gov> + + PR fortran/37039 + * gfortran.dg/PR37039.f90: New test. + 2011-06-02 Nicola Pero <nicola.pero@meta-innovation.com> PR objc/48539 diff --git a/gcc/testsuite/gfortran.dg/PR37039.f90 b/gcc/testsuite/gfortran.dg/PR37039.f90 new file mode 100644 index 0000000..6311f27 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/PR37039.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-fcray-pointer" } +! +! Test for PR37039, from an issue on comp.lang.fortran +! http://groups.google.com/group/comp.lang.fortran/msg/8cfa06f222721386 + + subroutine test(nnode) + implicit none + integer n,nnode + pointer(ip_tab, tab) + integer , dimension(1:nnode) :: tab + do n=1,nnode + tab(n) = 0 + enddo + end subroutine test |