From: Fritz Reese Date: Wed, 3 Sep 2014 18:50:27 +0000 (+0000) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=88f7d6fb23723894389f6560d47fc52fd7a8a1a8;p=gcc.git [multiple changes] 2014-09-03 Fritz Reese PR fortran/62174 * decl.c (variable_decl): Don't overwrite typespecs of Cray * pointees when matching a component declaration. 2014-09-02 Fritz Reese PR fortran/62174 * gfortran.dg/cray_pointers_11.f90: New. From-SVN: r214891 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 518923baa5f..9eeb4cf419b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2014-09-03 Fritz Reese + + PR fortran/62174 + * decl.c (variable_decl): Don't overwrite typespecs of Cray pointees + when matching a component declaration. + 2014-09-02 Marek Polacek PR fortran/62270 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 25d92a46d3e..e412a8bd070 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 f0bca8f0bc2..1312e4ecf56 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-02 Fritz Reese + + PR fortran/62174 + * gfortran.dg/cray_pointers_11.f90: New. + 2014-09-03 Martin Jambor 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 00000000000..d847676d82c --- /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