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]

FORTRAN -[patch for PR 9263 ICE caused by invalid PARAMETER in impliedDO loop]


Here is the problem:

Symbolic integer constant declared via PARAMETER not explicitly declared
as INTEGER (and not implicitly of type INTEGER) causes ICE if used as
a limit in an implied DO loop.


Example: <from PR 9263>


     PARAMETER (P=10)
     INTEGER C(10)
     DATA (C(I),I=1,P) /10*10/
     END

Gives (with every version of g77 I have):

bdavis at rh sbox6apr]$ /usr/bin/g77 ice.f
f771: ../../gcc/f/data.c:602: ffedata_advance_: Assertion `(((end)->info).basictype) == FFEINFO_basictypeINTEGER' failed.
ice.f: In program `MAIN__':
ice.f:3: internal error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.


The patch which diagnoses this illegal code (F77 requires the terminal value of an implied do loop in a data statement to be an Integer Constant Expression (some exceptions to this in the standard, but not relevant to this discussion)):

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 02:47:35 -0000
*************** tail_recurse: /* ::::::::::::::::::::
*** 598,603 ****
--- 598,612 ----
== 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);
assert (ffeinfo_kindtype (ffebld_info (end))



No regressions caused by this patch on i386-gnu-linux.


The example given above is a test case to be added to the "non-compile" directory, since this code is not valid FORTRAN.

How the test case is processed after the patch:

[bdavis at rh sbox6apr]$ /usr/local/bin/g77 ice.f
ice.f: In program `MAIN__':
ice.f:4:
        DATA (C(I),I=1,P) /10*10/
        ^
Not an integer constant expression in implied do-loop in statement at (^)


--bud davis




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