Message ID | CAE4aFAmpdZycpNrMo+ZQOq+d7vc5YtE7emwJnTUDM2EXXFm1XA@mail.gmail.com |
---|---|
State | New |
Headers | show |
Fritz Reese wrote: > The typespecs for Cray pointees are overwritten by the typespecs of > components with the same name which are declared later. > Here is a proposed patch from 4.8.3 (test case comments/ChangeLog > descriptions are updated from the submission on bugzilla). The test > case demonstrates the problem. OK. Thanks for the patch. I have committed it as Rev. 214891. > FYI, I am currently working with my employer so any future changes I > have can comply with GNU's legal requirements. That would be useful. In terms of complexity and number of line changes of the actual code, I think it still counts as "trivial" such that I have committed the patch without waiting for the copyright assignment. > Also my mail client replaces tabs with spaces so I'm sorry for any whitespace issues. An alternative would be to attach the patch – possibly such that the mail client uses "text/*" as MIME code (e.g. using ".txt" as suffix, though several programs also handle other extensions). That way it shows up as text in most email programs and in the mail archive as text. > 2014-09-02 Fritz Reese <Reese-Fritz@zai.com> > > PR fortran/62174 > * gcc/testsuite/gfortran.dg/cray_pointers_11.f90: New. Two nits: I'd prefer if you placed both changelogs before the actual patch - not between different parts of the patch. And entries in ChangeLog files are relative to the file, i.e. in this case "gfortran.dg/..." instead of "gcc/testsuite/gfortran.dg/...". Tobias
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 4048ac9..7b3c59a 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) 2014-09-02 Fritz Reese <Reese-Fritz@zai.com> PR fortran/62174 * gcc/testsuite/gfortran.dg/cray_pointers_11.f90: New. 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..038e4dc --- /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