Bug 20900 - use-associated variable may not be equivalenced
Summary: use-associated variable may not be equivalenced
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks: 20405
  Show dependency treegraph
 
Reported: 2005-04-08 16:05 UTC by Joost VandeVondele
Modified: 2005-10-01 15:57 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-05-19 17:34:35


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2005-04-08 16:05:49 UTC
The following is non-standard and the compiler should probably generate a
warning/error with '-pedantic -std=f95'

MODULE TEST
 INTEGER :: I
END MODULE
! note 11.7
USE TEST, ONLY : K=>I
INTEGER :: L
EQUIVALENCE(K,L)
END
Comment 1 Tobias Schlüter 2005-05-19 17:34:35 UTC
There's no 11.7 neither in the F95 nor the F2K drafts I'm having.  This is
invalid by the constraints in 5.5.1 in the F95 draft.  Is there any other
constraint you were aiming at?
Comment 2 Joost VandeVondele 2005-05-19 17:54:50 UTC
(In reply to comment #1)
> There's no 11.7 neither in the F95 nor the F2K drafts I'm having.  This is
> invalid by the constraints in 5.5.1 in the F95 draft.  Is there any other
> constraint you were aiming at?
 
No, off-by-one, refering to 'note 11.8' in 11.3.2 which mentions the same
constraint.
Comment 3 Tobias Schlüter 2005-05-19 19:22:45 UTC
Subject: Re:  use-associated variable may not be equivalenced

jv244 at cam dot ac dot uk wrote:
> ------- Additional Comments From jv244 at cam dot ac dot uk  2005-05-19 17:54 -------
> (In reply to comment #1)
> 
>>There's no 11.7 neither in the F95 nor the F2K drafts I'm having.  This is
>>invalid by the constraints in 5.5.1 in the F95 draft.  Is there any other
>>constraint you were aiming at?
> 
>  
> No, off-by-one, refering to 'note 11.8' in 11.3.2 which mentions the same
> constraint.

Thanks, I had only checked note 11.7 :-)

Comment 4 Paul Thomas 2005-09-26 19:32:27 UTC
This is resolved by http://gcc.gnu.org/ml/fortran/2005-09/msg00438.html

Paul T

Comment 5 GCC Commits 2005-10-01 07:39:37 UTC
Subject: Bug 20900

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pault@gcc.gnu.org	2005-10-01 07:39:08

Modified files:
	gcc/fortran    : ChangeLog gfortran.h match.c resolve.c symbol.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gfortran.dg/g77: 980628-2.f 980628-3.f 980628-9.f 
	                               980628-10.f 
Added files:
	gcc/testsuite/gfortran.dg: equiv_constraint_1.f90 
	                           equiv_constraint_2.f90 
	                           equiv_constraint_3.f90 
	                           equiv_constraint_4.f90 
	                           equiv_constraint_5.f90 
	                           equiv_constraint_6.f90 
	                           equiv_constraint_7.f90 
	                           equiv_constraint_8.f90 
	                           private_type_1.f90 private_type_2.f90 

Log message:
	2005-10-01  Paul Thomas  <pault@gcc.gnu.org>
	
	PR fortran/16404
	PR fortran/20835
	PR fortran/20890
	PR fortran/20899
	PR fortran/20900
	PR fortran/20901
	PR fortran/20902
	* gfortran.h: Prototype for gfc_add_in_equivalence.
	* match.c (gfc_match_equivalence): Make a structure component
	an explicit,rather than a syntax, error in an equivalence
	group.  Call gfc_add_in_equivalence to add the constraints
	imposed in check_conflict.
	* resolve.c (resolve_symbol): Add constraints: No public
	structures with private-type components and no public
	procedures with private-type dummy arguments.
	(resolve_equivalence_derived): Add constraint that prevents
	a structure equivalence member from having a default
	initializer.
	(sequence_type): New static function to determine whether an
	object is default numeric, default character, non-default
	or mixed sequence. Add corresponding enum typespec.
	(resolve_equivalence): Add constraints to equivalence groups
	or their members: No more than one initialized member and
	that different types are not equivalenced for std=f95.  All
	the simple constraints have been moved to check_conflict.
	* symbol.c (check_conflict): Simple equivalence constraints
	added, including those removed from resolve_symbol.
	(gfc_add_in_equivalence): New function to interface calls
	match_equivalence to check_conflict.
	
	2005-10-01  Paul Thomas  <pault@gcc.gnu.org>
	
	PR fortran/16404
	PR fortran/20835
	PR fortran/20890
	PR fortran/20899
	PR fortran/20900
	PR fortran/20901
	PR fortran/20902
	gfortran.dg/equiv_constraint_1.f90: New test.
	gfortran.dg/equiv_constraint_2.f90: New test.
	gfortran.dg/equiv_constraint_3.f90: New test.
	gfortran.dg/equiv_constraint_4.f90: New test.
	gfortran.dg/equiv_constraint_5.f90: New test.
	gfortran.dg/equiv_constraint_6.f90: New test.
	gfortran.dg/equiv_constraint_7.f90: New test.
	gfortran.dg/equiv_constraint_8.f90: New test.
	gfortran.dg/private_type_1.f90: New test.
	gfortran.dg/private_type_2.f90: New test.
	gfortran.dg/g77/980628-2.f, 980628-3.f, 980628-9.f,
	980628-10.f: Assert std=gnu to permit mixing of
	types in equivalence statements.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.572&r2=1.573
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/gfortran.h.diff?cvsroot=gcc&r1=1.87&r2=1.88
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/match.c.diff?cvsroot=gcc&r1=1.45&r2=1.46
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&r1=1.56&r2=1.57
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/symbol.c.diff?cvsroot=gcc&r1=1.35&r2=1.36
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6119&r2=1.6120
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_2.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_3.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_4.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_6.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_7.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_8.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/private_type_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/private_type_2.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/980628-2.f.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/980628-3.f.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/980628-9.f.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/980628-10.f.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 6 Andrew Pinski 2005-10-01 15:57:20 UTC
Fixed.
Comment 7 GCC Commits 2005-10-12 05:43:19 UTC
Subject: Bug 20900

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	pault@gcc.gnu.org	2005-10-12 05:43:08

Modified files:
	gcc/fortran    : ChangeLog gfortran.h match.c resolve.c symbol.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gfortran.dg/g77: 980628-2.f 980628-3.f 980628-9.f 
	                               980628-10.f 
Added files:
	gcc/testsuite/gfortran.dg: equiv_constraint_1.f90 
	                           equiv_constraint_2.f90 
	                           equiv_constraint_3.f90 
	                           equiv_constraint_4.f90 
	                           equiv_constraint_5.f90 
	                           equiv_constraint_6.f90 
	                           equiv_constraint_7.f90 
	                           equiv_constraint_8.f90 
	                           private_type_1.f90 private_type_2.f90 
	                           private_type_3.f90 

Log message:
	2005-10-12  Paul Thomas  <pault@gcc.gnu.org>
	
	PR fortran/16404
	PR fortran/20835
	PR fortran/20890
	PR fortran/20899
	PR fortran/20900
	PR fortran/20901
	PR fortran/20902
	PR fortran/24207
	* gfortran.h: Prototype for gfc_add_in_equivalence.
	* match.c (gfc_match_equivalence): Make a structure component
	an explicit,rather than a syntax, error in an equivalence
	group.  Call gfc_add_in_equivalence to add the constraints
	imposed in check_conflict.
	* resolve.c (resolve_symbol): Add constraints: No public
	structures with private-type components and no public
	procedures with private-type dummy arguments. Exclude use and
	host associated symbols from the test for private objects in
	a public namelist.
	(resolve_equivalence_derived): Add constraint that prevents
	a structure equivalence member from having a default
	initializer.
	(sequence_type): New static function to determine whether an
	object is default numeric, default character, non-default
	or mixed sequence. Add corresponding enum typespec.
	(resolve_equivalence): Add constraints to equivalence groups
	or their members: No more than one initialized member and
	that different types are not equivalenced for std=f95.  All
	the simple constraints have been moved to check_conflict.
	* symbol.c (check_conflict): Simple equivalence constraints
	added, including those removed from resolve_symbol.
	(gfc_add_in_equivalence): New function to interface calls
	match_equivalence to check_conflict.
	
	2005-10-12  Paul Thomas  <pault@gcc.gnu.org>
	
	PR fortran/16404
	PR fortran/20835
	PR fortran/20890
	PR fortran/20899
	PR fortran/20900
	PR fortran/20901
	PR fortran/20902
	PR fortran/24207
	gfortran.dg/equiv_constraint_1.f90: New test.
	gfortran.dg/equiv_constraint_2.f90: New test.
	gfortran.dg/equiv_constraint_3.f90: New test.
	gfortran.dg/equiv_constraint_4.f90: New test.
	gfortran.dg/equiv_constraint_5.f90: New test.
	gfortran.dg/equiv_constraint_6.f90: New test.
	gfortran.dg/equiv_constraint_7.f90: New test.
	gfortran.dg/equiv_constraint_8.f90: New test.
	gfortran.dg/private_type_1.f90: New test.
	gfortran.dg/private_type_2.f90: New test.
	gfortran.dg/private_type_3.f90: New test.
	gfortran.dg/g77/980628-2.f, 980628-3.f, 980628-9.f,
	980628-10.f: Assert std=gnu to permit mixing of
	types in equivalence statements.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.127&r2=1.335.2.128
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/gfortran.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.58.2.17&r2=1.58.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/match.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.31.8.12&r2=1.31.8.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.34.2.17&r2=1.34.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/symbol.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.26.2.4&r2=1.26.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.447&r2=1.5084.2.448
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_1.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_2.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_3.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_4.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_5.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_6.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_7.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/equiv_constraint_8.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/private_type_1.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/private_type_2.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/private_type_3.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/980628-2.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=1.1.46.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/980628-3.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=1.1.46.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/980628-9.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=1.1.46.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/g77/980628-10.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=1.1.46.1