Bug 18827 - ICE on assign to common variable
Summary: ICE on assign to common variable
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2004-12-04 12:41 UTC by Thomas Koenig
Modified: 2005-03-16 00:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-12-04 13:16:07


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2004-12-04 12:41:28 UTC
$ cat assign3.f
      program main
      integer*4 i
      common /foo/ i
      assign 1000 to i
 1000 continue
      end
$ gfortran assign3.f
 In file assign3.f:4

      assign 1000 to i
                                                                       1
Warning: Obsolete: ASSIGN statement at (1)
assign3.f: In function 'MAIN__':
assign3.f:4: internal compiler error: tree check: expected class
'declaration',have 'reference' (component_ref) in gfc_trans_label_assign, at
fortran/trans-stmt.c:101
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
$ gfortran -v
Reading specs from /home/ig25/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --prefix=/home/ig25
--enable-languages=c,c++,f95 --disable-shared
Thread model: posix
gcc version 4.0.0 20041204 (experimental)
Comment 1 Andrew Pinski 2004-12-04 13:16:07 UTC
Confirmed.
Comment 2 Thomas Koenig 2004-12-04 14:56:59 UTC
The same bug is triggered if the assigned variable
is equivalenced:

$ cat assign4.f
      program main
      integer i
      integer j
      equivalence (i,j)
      assign 1000 to i
      goto j
 1000 continue
      end
$ gfortran assign4.f
 In file assign4.f:5

      assign 1000 to i
                                                                       1
Warning: Obsolete: ASSIGN statement at (1)
 In file assign4.f:6

      goto j
           1
Warning: Obsolete: Assigned GOTO statement at (1)
assign4.f: In function 'MAIN__':
assign4.f:5: internal compiler error: tree check: expected class
'declaration',have 'reference' (component_ref) in gfc_trans_label_assign, at
fortran/trans-stmt.c:101
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 3 Feng Wang 2004-12-10 14:58:53 UTC
I've fixed the first and am looking into the second. I think the second 
(variable with equivalence)is an invalid code. ifort also gives an error.
Comment 5 CVS Commits 2005-03-15 02:52:51 UTC
Subject: Bug 18827

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	fengwang@gcc.gnu.org	2005-03-15 02:52:38

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/fortran    : ChangeLog io.c match.c resolve.c trans-common.c 
	                 trans-stmt.c trans-io.c trans.h 
Added files:
	gcc/testsuite/gfortran.dg: assign.f90 assign_2.f90 assign_3.f90 

Log message:
	fortran/
	2005-03-15  Feng Wang  <fengwang@nudt.edu.cn>
	
	PR fortran/18827
	* io.c (resolve_tag): Add checking on assigned label.
	(match_dt_format): Does not set symbol assign attribute.
	* match.c (gfc_match_goto):Does not set symbol assign attribute.
	* resolve.c (resolve_code): Add checking on assigned label.
	* trans-common.c (build_field): Deals with common variable assigned
	a label.
	* trans-stmt.c (gfc_conv_label_variable): New function.
	(gfc_trans_label_assign): Use it.
	(gfc_trans_goto): Ditto.
	* trans-io.c (set_string): Ditto.
	* trans.h (gfc_conv_label_variable): Add prototype.
	testsuite/
	2005-03-15  Feng Wang  <fengwang@nudt.edu.cn>
	
	PR fortran/18827
	* gfortran.dg/assign_2.f90: New test.
	* gfortran.dg/assign_3.f90: New test.
	* gfortran.dg/assign.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5169&r2=1.5170
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/assign.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/assign_2.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/assign_3.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.353&r2=1.354
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/io.c.diff?cvsroot=gcc&r1=1.19&r2=1.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/match.c.diff?cvsroot=gcc&r1=1.31&r2=1.32
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&r1=1.37&r2=1.38
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-common.c.diff?cvsroot=gcc&r1=1.24&r2=1.25
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-stmt.c.diff?cvsroot=gcc&r1=1.24&r2=1.25
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-io.c.diff?cvsroot=gcc&r1=1.33&r2=1.34
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans.h.diff?cvsroot=gcc&r1=1.24&r2=1.25

Comment 6 CVS Commits 2005-03-15 03:43:00 UTC
Subject: Bug 18827

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	fengwang@gcc.gnu.org	2005-03-15 03:42:49

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/fortran    : ChangeLog io.c match.c resolve.c trans-common.c 
	                 trans-stmt.c trans-io.c trans.h 
Added files:
	gcc/testsuite/gfortran.dg: assign.f90 assign_2.f90 assign_3.f90 

Log message:
	fortran/
	2005-03-15  Feng Wang  <fengwang@nudt.edu.cn>
	
	PR fortran/18827
	* io.c (resolve_tag): Add checking on assigned label.
	(match_dt_format): Does not set symbol assign attribute.
	* match.c (gfc_match_goto):Does not set symbol assign attribute.
	* resolve.c (resolve_code): Add checking on assigned label.
	* trans-common.c (build_field): Deals with common variable assigned
	a label.
	* trans-stmt.c (gfc_conv_label_variable): New function.
	(gfc_trans_label_assign): Use it.
	(gfc_trans_goto): Ditto.
	* trans-io.c (set_string): Ditto.
	* trans.h (gfc_conv_label_variable): Add prototype.
	testsuite/
	2005-03-15  Feng Wang  <fengwang@nudt.edu.cn>
	
	PR fortran/18827
	* gfortran.dg/assign_2.f90: New test.
	* gfortran.dg/assign_3.f90: New test.
	* gfortran.dg/assign.f90: New test.

Patches:
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.47&r2=1.5084.2.48
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/assign.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/assign_2.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/assign_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/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.13&r2=1.335.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/io.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.19&r2=1.19.10.1
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&r2=1.31.8.1
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.3&r2=1.34.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-common.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.23.2.1&r2=1.23.2.2
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&r2=1.24.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-io.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.33&r2=1.33.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.23.2.1&r2=1.23.2.2

Comment 7 fengwang 2005-03-16 00:19:51 UTC
Fixed