[Bug fortran/31188] ICE on vector subscript of a parameter array

2007-03-16 Thread burnus at gcc dot gnu dot org


--- Comment #5 from burnus at gcc dot gnu dot org  2007-03-16 10:57 ---
Subject: Bug 31188

Author: burnus
Date: Fri Mar 16 10:57:45 2007
New Revision: 122987

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=122987
Log:
2007-03-16  Paul Thomas  [EMAIL PROTECTED]
Tobias Burnus  [EMAIL PROTECTED]

PR fortran/31188
* expr.c (find_array_section): Allow
  non-expression-constant variables.

2007-03-16  Tobias Burnus  [EMAIL PROTECTED]

PR fortran/31188
* gfortran.dg/parameter_array_dummy.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/parameter_array_dummy.f90
Modified:
trunk/gcc/fortran/expr.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31188



[Bug fortran/31188] ICE on vector subscript of a parameter array

2007-03-15 Thread fxcoudert at gcc dot gnu dot org


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
  Known to fail||4.2.0 4.3.0
   Last reconfirmed|-00-00 00:00:00 |2007-03-15 14:28:10
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31188



[Bug fortran/31188] ICE on vector subscript of a parameter array

2007-03-15 Thread burnus at gcc dot gnu dot org


--- Comment #1 from burnus at gcc dot gnu dot org  2007-03-15 19:31 ---
If one comments out the if block in gfc_simplify_expr (expr.c):
--
case EXPR_VARIABLE:
  /* Only substitute array parameter variables if we are in an
 initialization expression, or we want a subsection.  */
  if (p-symtree-n.sym-attr.flavor == FL_PARAMETER
   (gfc_init_expr || p-ref
  || p-symtree-n.sym-value-expr_type != EXPR_ARRAY))
{
  if (simplify_parameter_variable (p, type) == FAILURE)
return FAILURE;
  break;
}
--
The program works as expected. n.sym-name is ivec. I don't understand why ivec
is FL_PARAMETER and not FL_VARIABLE.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31188



[Bug fortran/31188] ICE on vector subscript of a parameter array

2007-03-15 Thread pault at gcc dot gnu dot org


--- Comment #3 from pault at gcc dot gnu dot org  2007-03-15 20:36 ---
(In reply to comment #2)
(In reply to comment #1)

 The program works as expected. n.sym-name is ivec. I don't understand why 
 ivec
 is FL_PARAMETER and not FL_VARIABLE.

It is not correct to have the line gcc_assert (begin-expr_type == EXPR_ARRAY).
This section was somebody else's (no names!) contribution to this function:)

This expression is not simplifiable and should return on finding that the
vector index is a variabe.  This works correctly:


Index: gcc/fortran/expr.c
===
*** gcc/fortran/expr.c  (revision 122847)
--- gcc/fortran/expr.c  (working copy)
*** find_array_section (gfc_expr *expr, gfc_
*** 1062,1069 

if (ref-u.ar.dimen_type[d] == DIMEN_VECTOR)  /* Vector subscript.  */
{
! gcc_assert (begin);
! gcc_assert (begin-expr_type == EXPR_ARRAY);
  gcc_assert (begin-rank == 1);
  gcc_assert (begin-shape);

--- 1062,1075 

if (ref-u.ar.dimen_type[d] == DIMEN_VECTOR)  /* Vector subscript.  */
{
! gcc_assert (begin);
!
! if  (begin-expr_type == EXPR_ARRAY);
!   {
! t = FAILURE;
! goto cleanup;
!   }
!
  gcc_assert (begin-rank == 1);
  gcc_assert (begin-shape);

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31188



[Bug fortran/31188] ICE on vector subscript of a parameter array

2007-03-15 Thread patchapp at dberlin dot org


--- Comment #4 from patchapp at dberlin dot org  2007-03-15 20:55 ---
Subject: Bug number PR31188

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01045.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31188