Bug 20838 - ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:3606
Summary: ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:3606
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.0.3
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2005-04-08 15:49 UTC by Joost VandeVondele
Modified: 2006-06-05 10:27 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.1.0 4.0.0
Last reconfirmed: 2005-09-18 06:01:40


Attachments

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

INTEGER, PARAMETER, DIMENSION(3) :: subs=(/1,3,2/)
INTEGER, DIMENSION(3), TARGET :: vals
INTEGER, POINTER, DIMENSION(:) :: ptr
ptr=>vals(subs)
END
Comment 1 Francois-Xavier Coudert 2005-04-09 19:05:16 UTC
On i686-linux, I get:

pr20838.f90: In function MAIN__:
pr20838.f90:4: internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:3606
Comment 2 Serge Belyshev 2005-04-15 12:44:53 UTC
Confirmed.
Comment 3 Paul Thomas 2005-11-06 20:05:19 UTC
Subject: Bug 20838

Author: pault
Date: Sun Nov  6 20:05:12 2005
New Revision: 106567

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106567
Log:
2005-11-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24534
	* resolve.c (resolve_symbol): Exclude case of PRIVATE declared
	within derived type from error associated with PRIVATE type
	components within derived type.

	PR fortran/20838
	PR fortran/20840
	* gfortran.h: Add prototype for gfc_has_vector_index.
	* io.c (gfc_resolve_dt): Error if internal unit has a vector index.
	* expr.c (gfc_has_vector_index): New function to check if any of
	the array references of an expression have vector inidices.
	(gfc_check_pointer_assign): Error if internal unit has a vector index.

	PR fortran/17737
	* data.c (gfc_assign_data_value): Remove gcc_assert that caused the ICE
	and replace by a standard dependent warning/error if overwriting an
	existing initialization.
	* decl.c (gfc_data_variable): Remove old error for already initialized
	variable and the unused error check for common block variables.  Add
	error for hots associated variable and standard dependent error for
	common block variables, outside of blockdata.
	* symbol.c (check_conflict): Add constraints for DATA statement.

2005-11-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24534
	gfortran.dg/private_type_2.f90: Modified to check that case with
	PRIVATE declaration within derived type is accepted.

	PR fortran/20838
	gfortran.dg/pointer_assign_1.f90: New test.

	PR fortran/20840
	* gfortran.dg/arrayio_0.f90: New test.

	PR fortran/17737
	gfortran.dg/data_initialized.f90: New test.
	gfortran.dg/data_constraints_1.f90: New test.
	gfortran.dg/data_constraints_2.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/arrayio_0.f90   (with props)
    trunk/gcc/testsuite/gfortran.dg/data_constraints_1.f90
    trunk/gcc/testsuite/gfortran.dg/data_constraints_2.f90
    trunk/gcc/testsuite/gfortran.dg/data_initialized.f90
    trunk/gcc/testsuite/gfortran.dg/pointer_assign_1.f90   (with props)
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/data.c
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/io.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/private_type_2.f90

Added: trunk/gcc/testsuite/gfortran.dg/arrayio_0.f90
URL: http://gcc.gnu.org/viewcvs/trunk/gcc/testsuite/gfortran.dg/arrayio_0.f90?root=gcc&view=auto&rev=106567
==============================================================================
--- trunk/gcc/testsuite/gfortran.dg/arrayio_0.f90 (added)
+++ trunk/gcc/testsuite/gfortran.dg/arrayio_0.f90 Sun Nov  6 20:05:12 2005
@@ -1,0 +1,19 @@
+! { dg-do compile }
+! Tests fix for PR20840 - would ICE with vector subscript in 
+! internal unit.
+!
+! Contributed by Paul Thomas  <pault@gcc.gnu.org>
+!
+  character(len=12), dimension(4) :: iu, buff
+  character(len=48), dimension(2) :: iue
+  equivalence (iu, iue)
+  integer, dimension(4) :: v = (/2,1,4,3/)
+  iu = (/"Vector","subscripts","not","allowed!"/)
+  read (iu, '(a12/)') buff
+  read (iue(1), '(4a12)') buff
+  read (iu(4:1:-1), '(a12/)') buff
+  read (iu(v), '(a12/)') buff           ! { dg-error "with vector subscript" }
+  read (iu((/2,4,3,1/)), '(a12/)') buff ! { dg-error "with vector subscript" }
+  print *, buff
+  end
+

Propchange: trunk/gcc/testsuite/gfortran.dg/arrayio_0.f90
            ('svn:executable' added)

Added: trunk/gcc/testsuite/gfortran.dg/pointer_assign_1.f90
URL: http://gcc.gnu.org/viewcvs/trunk/gcc/testsuite/gfortran.dg/pointer_assign_1.f90?root=gcc&view=auto&rev=106567
==============================================================================
--- trunk/gcc/testsuite/gfortran.dg/pointer_assign_1.f90 (added)
+++ trunk/gcc/testsuite/gfortran.dg/pointer_assign_1.f90 Sun Nov  6 20:05:12 2005
@@ -1,0 +1,17 @@
+! { dg-do compile }
+! Tests fix for PR20838 - would ICE with vector subscript in 
+! pointer assignment.
+!
+! Contributed by Paul Thomas  <pault@gcc.gnu.org>
+!
+  integer, parameter, dimension(3) :: i = (/2,1,3/)
+  integer, dimension(3), target   :: tar
+  integer, dimension(2, 3), target   :: tar2
+  integer, dimension(:), pointer  :: ptr
+  ptr => tar
+  ptr => tar(3:1:-1)
+  ptr => tar(i)     ! { dg-error "with vector subscript" }
+  ptr => tar2(1, :)
+  ptr => tar2(2, i) ! { dg-error "with vector subscript" }
+  end
+

Propchange: trunk/gcc/testsuite/gfortran.dg/pointer_assign_1.f90
            ('svn:executable' added)


Comment 4 Paul Thomas 2005-11-06 22:50:51 UTC
Subject: Bug 20838

Author: pault
Date: Sun Nov  6 22:50:38 2005
New Revision: 106572

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106572
Log:
2005-11-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24534
	* resolve.c (resolve_symbol): Exclude case of PRIVATE declared
	within derived type from error associated with PRIVATE type
	components within derived type.

	PR fortran/20838
	PR fortran/20840
	* gfortran.h: Add prototype for gfc_has_vector_index.
	* io.c (gfc_resolve_dt): Error if internal unit has a vector index.
	* expr.c (gfc_has_vector_index): New function to check if any of
	the array references of an expression have vector inidices.
	(gfc_check_pointer_assign): Error if internal unit has a vector index.

	PR fortran/17737
	* data.c (gfc_assign_data_value): Remove gcc_assert that caused the ICE
	and replace by a standard dependent warning/error if overwriting an
	existing initialization.
	* decl.c (gfc_data_variable): Remove old error for already initialized
	variable and the unused error check for common block variables.  Add
	error for host associated variable and standard dependent error for
	common block variables, outside of blockdata.
	* symbol.c (check_conflict): Add constraints for DATA statement.

2005-11-06  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24534
	gfortran.dg/private_type_2.f90: Modified to check that case with
	PRIVATE declaration within derived type is accepted.

	PR fortran/20838
	gfortran.dg/pointer_assign_1.f90: New test.

	PR fortran/20840
	* gfortran.dg/arrayio_0.f90: New test.

	PR fortran/17737
	gfortran.dg/data_initialized.f90: New test.
	gfortran.dg/data_constraints_1.f90: New test.
	gfortran.dg/data_constraints_2.f90: New test.


Added:
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/arrayio_0.f90   (with props)
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/data_constraints_1.f90
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/data_constraints_2.f90
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/data_initialized.f90
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/pointer_assign_1.f90   (with props)
Modified:
    branches/gcc-4_0-branch/gcc/fortran/ChangeLog
    branches/gcc-4_0-branch/gcc/fortran/data.c
    branches/gcc-4_0-branch/gcc/fortran/decl.c
    branches/gcc-4_0-branch/gcc/fortran/expr.c
    branches/gcc-4_0-branch/gcc/fortran/gfortran.h
    branches/gcc-4_0-branch/gcc/fortran/io.c
    branches/gcc-4_0-branch/gcc/fortran/resolve.c
    branches/gcc-4_0-branch/gcc/fortran/symbol.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/private_type_2.f90

Added: branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/arrayio_0.f90
URL: http://gcc.gnu.org/viewcvs/branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/arrayio_0.f90?root=gcc&view=auto&rev=106572
==============================================================================
--- branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/arrayio_0.f90 (added)
+++ branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/arrayio_0.f90 Sun Nov  6 22:50:38 2005
@@ -1,0 +1,19 @@
+! { dg-do compile }
+! Tests fix for PR20840 - would ICE with vector subscript in 
+! internal unit.
+!
+! Contributed by Paul Thomas  <pault@gcc.gnu.org>
+!
+  character(len=12), dimension(4) :: iu, buff
+  character(len=48), dimension(2) :: iue
+  equivalence (iu, iue)
+  integer, dimension(4) :: v = (/2,1,4,3/)
+  iu = (/"Vector","subscripts","not","allowed!"/)
+  read (iu, '(a12/)') buff
+  read (iue(1), '(4a12)') buff
+  read (iu(4:1:-1), '(a12/)') buff
+  read (iu(v), '(a12/)') buff           ! { dg-error "with vector subscript" }
+  read (iu((/2,4,3,1/)), '(a12/)') buff ! { dg-error "with vector subscript" }
+  print *, buff
+  end
+

Propchange: branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/arrayio_0.f90
            ('svn:executable' added)

Added: branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/pointer_assign_1.f90
URL: http://gcc.gnu.org/viewcvs/branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/pointer_assign_1.f90?root=gcc&view=auto&rev=106572
==============================================================================
--- branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/pointer_assign_1.f90 (added)
+++ branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/pointer_assign_1.f90 Sun Nov  6 22:50:38 2005
@@ -1,0 +1,17 @@
+! { dg-do compile }
+! Tests fix for PR20838 - would ICE with vector subscript in 
+! pointer assignment.
+!
+! Contributed by Paul Thomas  <pault@gcc.gnu.org>
+!
+  integer, parameter, dimension(3) :: i = (/2,1,3/)
+  integer, dimension(3), target   :: tar
+  integer, dimension(2, 3), target   :: tar2
+  integer, dimension(:), pointer  :: ptr
+  ptr => tar
+  ptr => tar(3:1:-1)
+  ptr => tar(i)     ! { dg-error "with vector subscript" }
+  ptr => tar2(1, :)
+  ptr => tar2(2, i) ! { dg-error "with vector subscript" }
+  end
+

Propchange: branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/pointer_assign_1.f90
            ('svn:executable' added)


Comment 5 Paul Thomas 2005-11-06 22:53:47 UTC
Fixed on mainline and 4.0
Comment 6 Paul Thomas 2006-06-05 07:45:17 UTC
Subject: Bug 20838

Author: pault
Date: Mon Jun  5 07:45:03 2006
New Revision: 114385

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114385
Log:
2006-06-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/14067
	* data.c (create_character_intializer): Add warning message
	for truncated string.

	PR fortran/16943
	* symbol.c : Include flags.h.
	(gfc_add_type): If a procedure and types are the same do not
	throw an error unless standard is less than gnu or pedantic.

	PR fortran/20838
	* parse.c (parse_do_block): Error if named block do construct
	does not have a named enddo.

	PR fortran/27655
	* check.c (gfc_check_associated): Pick up EXPR_NULL for pointer
	as well as target and put error return at end of function.

2006-06-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/14067
	* gfortran.dg/data_char_1.f90: Add messages for truncated
	strings.

	PR fortran/16943
	* gfortran.dg/func_decl_2.f90: New test.

	PR fortran/20838
	* gfortran.dg/do_2.f90: New test.

	PR fortran/27655
	* gfortran.dg/associated_3.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/associated_3.f90
    trunk/gcc/testsuite/gfortran.dg/do_2.f90
    trunk/gcc/testsuite/gfortran.dg/func_decl_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/data.c
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/data_char_1.f90

Comment 7 Paul Thomas 2006-06-05 10:14:47 UTC
Subject: Bug 20838

Author: pault
Date: Mon Jun  5 10:14:32 2006
New Revision: 114387

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114387
Log:
2006-06-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/14067
	* data.c (create_character_intializer): Add warning message
	for truncated string.

	PR fortran/16943
	* symbol.c : Include flags.h.
	(gfc_add_type): If a procedure and types are the same do not
	throw an error unless standard is less than gnu or pedantic.

	PR fortran/20838
	* parse.c (parse_do_block): Error if named block do construct
	does not have a named enddo.

	PR fortran/27655
	* check.c (gfc_check_associated): Pick up EXPR_NULL for pointer
	as well as target and put error return at end of function.

2006-06-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/14067
	* gfortran.dg/data_char_1.f90: Add messages for truncated
	strings.

	PR fortran/16943
	* gfortran.dg/func_decl_2.f90: New test.

	PR fortran/20838
	* gfortran.dg/do_2.f90: New test.

	PR fortran/27655
	* gfortran.dg/associated_3.f90: New test.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/associated_3.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/do_2.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/func_decl_2.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/check.c
    branches/gcc-4_1-branch/gcc/fortran/data.c
    branches/gcc-4_1-branch/gcc/fortran/parse.c
    branches/gcc-4_1-branch/gcc/fortran/symbol.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/data_char_1.f90

Comment 8 Paul Thomas 2006-06-05 10:27:26 UTC
Apologies, I screwed up a ChangeLog entry - should have been the next PR.

Will crrect the ChangeLogs tonight.

Paul