This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: FORTRAN -[patch for PR 9263 ICE caused by invalid PARAMETER inimpliedDO loop]


Upon closer reflection, an ICE will be caused by the start, end, or iteration count of an implied DO not being a constant integer expression.

So, here is a patch that fixes all of them:

Index: gcc/gcc/f/data.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/data.c,v
retrieving revision 1.8
diff -c -3 -p -r1.8 data.c
*** gcc/gcc/f/data.c 13 Feb 2002 07:39:56 -0000 1.8
--- gcc/gcc/f/data.c 6 Apr 2003 15:05:01 -0000
*************** tail_recurse: /* ::::::::::::::::::::
*** 591,602 ****
assert (ffeinfo_kindtype (ffebld_info (itervar))
== FFEINFO_kindtypeINTEGERDEFAULT);
ffedata_stack_->itervar = ffebld_symter (itervar);
!
assert (ffeinfo_basictype (ffebld_info (start))
== FFEINFO_basictypeINTEGER);
assert (ffeinfo_kindtype (ffebld_info (start))
== FFEINFO_kindtypeINTEGERDEFAULT);
ffesymbol_set_value (ffedata_stack_->itervar, ffedata_eval_integer1_ (start));


assert (ffeinfo_basictype (ffebld_info (end))
== FFEINFO_basictypeINTEGER);
--- 591,619 ----
assert (ffeinfo_kindtype (ffebld_info (itervar))
== FFEINFO_kindtypeINTEGERDEFAULT);
ffedata_stack_->itervar = ffebld_symter (itervar);
! if (ffeinfo_basictype (ffebld_info (start)) != FFEINFO_basictypeINTEGER)
! {
! ffebad_start (FFEBAD_DATA_EVAL);
! ffest_ffebad_here_current_stmt (0);
! ffebad_finish ();
! ffedata_pop_ ();
! ffedata_reported_error_ = TRUE;
! return FALSE;
! }
assert (ffeinfo_basictype (ffebld_info (start))
== FFEINFO_basictypeINTEGER);
assert (ffeinfo_kindtype (ffebld_info (start))
== FFEINFO_kindtypeINTEGERDEFAULT);
ffesymbol_set_value (ffedata_stack_->itervar, ffedata_eval_integer1_ (start));
+ if (ffeinfo_basictype (ffebld_info (end)) != FFEINFO_basictypeINTEGER)
+ {
+ ffebad_start (FFEBAD_DATA_EVAL);
+ ffest_ffebad_here_current_stmt (0);
+ ffebad_finish ();
+ ffedata_pop_ ();
+ ffedata_reported_error_ = TRUE;
+ return FALSE;
+ }


assert (ffeinfo_basictype (ffebld_info (end))
== FFEINFO_basictypeINTEGER);
*************** tail_recurse: /* ::::::::::::::::::::
*** 608,613 ****
--- 625,639 ----
ffedata_stack_->increment = 1;
else
{
+ if (ffeinfo_basictype (ffebld_info (incr)) != FFEINFO_basictypeINTEGER)
+ {
+ ffebad_start (FFEBAD_DATA_EVAL);
+ ffest_ffebad_here_current_stmt (0);
+ ffebad_finish ();
+ ffedata_pop_ ();
+ ffedata_reported_error_ = TRUE;
+ return FALSE;
+ }
assert (ffeinfo_basictype (ffebld_info (incr))
== FFEINFO_basictypeINTEGER);
assert (ffeinfo_kindtype (ffebld_info (incr))



and a test, for the non-compile directory:


     PARAMETER (Q=1)
     PARAMETER (P=10)
     INTEGER C(10),D(10),E(10),F(10)
     DATA (C(I),I=1,P)  /10*10/   ! TERMINAL NOT INT
     DATA (D(I),I=Q,10) /10*10/   ! START NOT INT
     DATA (E(I),I=1,10,Q) /10*10/ ! DELTA NOT INT
     END

with output like this:

[bdavis at rh sbox9apr]$ g77 ice.f
ice.f: In program `MAIN__':
ice.f:4:
        DATA (C(I),I=1,P)  /10*10/   ! TERMINAL NOT INT
        ^
Not an integer constant expression in implied do-loop in statement at (^)
ice.f:5:
        DATA (D(I),I=Q,10) /10*10/   ! START NOT INT
        ^
Not an integer constant expression in implied do-loop in statement at (^)
ice.f:6:
        DATA (E(I),I=1,10,Q) /10*10/ ! DELTA NOT INT
        ^
Not an integer constant expression in implied do-loop in statement at (^)


tested on i386-gnu-linux with no additional regression failures (make -k check-g77 only).





--bud davis



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]