Bug 1134560
Summary: | Component declarations overwrite types of Cray Pointee variables | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Fritz Reese <fritz> | ||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED ERRATA | QA Contact: | Miroslav Franc <mfranc> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 6.4 | CC: | fritz, mcermak, mfranc, mnewsome, mpolacek, ohudlick | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | x86_64 | ||||||
OS: | Linux | ||||||
URL: | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62174 | ||||||
Whiteboard: | |||||||
Fixed In Version: | gcc-4.4.7-12.el6 | Doc Type: | Bug Fix | ||||
Doc Text: |
In previous versions of the GNU Fortran compiler, the type specifiers for Cray pointees were incorrectly overwritten by the type specifiers of components with the same name. Consequently, compiling failed with an error message. This bug has been fixed, and the Cray pointers are now handled correctly.
|
Story Points: | --- | ||||
Clone Of: | Environment: | ||||||
Last Closed: | 2015-07-22 06:48:16 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Fritz Reese
2014-08-27 19:07:49 UTC
Created attachment 931658 [details]
Patch and testcase
Here is a proposed patch and testcase. When variable_decl() finds a declaration which shares a name with a Cray pointee, it should not care if the declaration is actually a component declaration.
2014-08-18 Fritz Reese <Reese-Fritz>
* decl.c (variable_decl): Don't overwrite typespecs of Cray pointees
when matching a component declaration.
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)
diff --git a/gcc/testsuite/gfortran.dg/cray_pointers_10.f90 b/gcc/testsuite/gfortran.dg/cray_pointers_10.f90
new file mode 100644
index 0000000..fcc0132
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/cray_pointers_10.f90
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! { dg-options "-fcray-pointer" }
+!
+! Since the introduction of Cray pointers in 4.1.0 as late as 4.8.3,
+! 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
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-1339.html |