aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFritz Reese <Reese-Fritz@zai.com>2014-09-03 18:50:27 +0000
committerTobias Burnus <burnus@gcc.gnu.org>2014-09-03 20:50:27 +0200
commit88f7d6fb23723894389f6560d47fc52fd7a8a1a8 (patch)
tree472315ccf1be11386f4b497c99ee39b6feb59fef
parent64e04187a14a428f727e6ee0fb7abd939843935c (diff)
downloadgcc-88f7d6fb23723894389f6560d47fc52fd7a8a1a8.zip
gcc-88f7d6fb23723894389f6560d47fc52fd7a8a1a8.tar.gz
gcc-88f7d6fb23723894389f6560d47fc52fd7a8a1a8.tar.bz2
[multiple changes]
2014-09-03 Fritz Reese <Reese-Fritz@zai.com> PR fortran/62174 * decl.c (variable_decl): Don't overwrite typespecs of Cray * pointees when matching a component declaration. 2014-09-02 Fritz Reese <Reese-Fritz@zai.com> PR fortran/62174 * gfortran.dg/cray_pointers_11.f90: New. From-SVN: r214891
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/decl.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/cray_pointers_11.f9022
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 518923b..9eeb4cf 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2014-09-03 Fritz Reese <Reese-Fritz@zai.com>
+
+ PR fortran/62174
+ * decl.c (variable_decl): Don't overwrite typespecs of Cray pointees
+ when matching a component declaration.
+
2014-09-02 Marek Polacek <polacek@redhat.com>
PR fortran/62270
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 25d92a4..e412a8b 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1904,8 +1904,9 @@ variable_decl (int elem)
}
/* If this symbol has already shown up in a Cray Pointer declaration,
+ and this is not a component declaration,
then we want to set the type & bail out. */
- if (gfc_option.flag_cray_pointer)
+ if (gfc_option.flag_cray_pointer && gfc_current_state () != COMP_DERIVED)
{
gfc_find_symbol (name, gfc_current_ns, 1, &sym);
if (sym != NULL && sym->attr.cray_pointee)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f0bca8f..1312e4e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-02 Fritz Reese <Reese-Fritz@zai.com>
+
+ PR fortran/62174
+ * gfortran.dg/cray_pointers_11.f90: New.
+
2014-09-03 Martin Jambor <mjambor@suse.cz>
PR ipa/62015
diff --git a/gcc/testsuite/gfortran.dg/cray_pointers_11.f90 b/gcc/testsuite/gfortran.dg/cray_pointers_11.f90
new file mode 100644
index 0000000..d847676
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/cray_pointers_11.f90
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! { dg-options "-fcray-pointer" }
+!
+! PR fortran/62174
+! Component declarations within derived types would overwrite the typespec of
+! variables with the same name who were Cray pointees.
+implicit none
+
+type t1
+ integer i
+end type t1
+type(t1) x
+
+pointer (x_ptr, x)
+
+type t2
+ real x ! should not overwrite x's type
+end type t2
+
+x%i = 0 ! should see no error here
+
+end