Bug 21257

Summary: [4.0 only] Duplicate use of construct name
Product: gcc Reporter: kargls
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs
Priority: P2 Keywords: patch
Version: 4.1.0   
Target Milestone: 4.0.2   
Host: Target:
Build: Known to work: 4.1.0
Known to fail: Last reconfirmed: 2005-04-28 08:04:16

Description kargls 2005-04-27 19:02:19 UTC
Consider the following program:

   program f
     integer i
     loop: do i = 1, 5
              print *, i
           end do loop
     loop: do i = 1, 5
              print *, i
           end do loop
   end program f

Gfortran compiles the program and it executes both loops.
NAG's compiler claims it is illegal.

kargl[206] f95 -o f f.f90
Error: f.f90, line 9: Duplicate construct name LOOP
       detected at <end-of-statement>@LOOP
[f95 terminated - errors found by pass 1]
Comment 1 GCC Commits 2005-06-20 19:17:47 UTC
Subject: Bug 21257

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	kargl@gcc.gnu.org	2005-06-20 19:17:33

Modified files:
	gcc/fortran    : ChangeLog match.c 

Log message:
	PR fortran/21257
	(Ported from g95)
	* match.c (gfc_match_label): Detect duplicate labels.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.467&r2=1.468
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/match.c.diff?cvsroot=gcc&r1=1.38&r2=1.39

Comment 2 kargls 2005-06-20 19:22:21 UTC
Fixed on mainline.  Will apply to 4.0.x when branch re-opens.
Comment 3 GCC Commits 2005-07-08 21:19:41 UTC
Subject: Bug 21257

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	kargl@gcc.gnu.org	2005-07-08 21:19:28

Modified files:
	gcc/fortran    : ChangeLog intrinsic.c match.c primary.c 
	                 trans-array.c trans-array.h trans-decl.c 
	                 trans-stmt.c 

Log message:
	Backport from the mainline:
	PR fortran/21257
	(port from g95)
	* match.c (gfc_match_label): Detect duplicate labels.
	* gfortran.dg/duplicate_labels.f90: New test.
	
	PR fortran/19926
	* primary.c (gfc_match_rvalue):  expr_type can be EXPR_CONSTANT
	for an array; check that sym->as is NULL.
	* gfortran.dg/pr19926.f90: New test.
	
	PR fortran/17792
	PR fortran/21375
	* trans-array.c (gfc_array_deallocate): pstat is new argument
	(gfc_array_allocate): update gfc_array_deallocate() call.
	(gfc_trans_deferred_array): ditto.
	* trans-array.h: update gfc_array_deallocate() prototype.
	* trans-decl.c (gfc_build_builtin_function_decls): update declaration
	* trans-stmt.c (gfc_trans_deallocate): Implement STAT= feature.
	
	* intrinsic.c (gfc_intrinsic_func_interface): Enable errors for generic
	functions whose simplification routine return FAILURE.

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.76&r2=1.335.2.77
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/intrinsic.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.44.2.3&r2=1.44.2.4
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.7&r2=1.31.8.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/primary.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.22.2.4&r2=1.22.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.39.2.5&r2=1.39.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.7.18.1&r2=1.7.18.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.54.2.3&r2=1.54.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-stmt.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.24.6.5&r2=1.24.6.6

Comment 5 kargls 2005-07-08 21:26:48 UTC
Back ported to 4.0