diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 14f1b845aa3..d6ff7194b19 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,10 @@ +2003-04-11 Bud Davis + + PR Fortran/9263 + * gcc/f/data.c (ffedata_advance_): Check initial, final and + increment values for INTEGER typeness. + * gcc/f/news.texi: Document these fixes. + 2003-03-27 Steven Bosscher * ffe.texi: Don't mention dead file proj.c. diff --git a/gcc/f/data.c b/gcc/f/data.c index 3e1ae6213cb..91b835dbc60 100644 --- a/gcc/f/data.c +++ b/gcc/f/data.c @@ -1,5 +1,5 @@ /* data.c -- Implementation File (module.c template V1.0) - Copyright (C) 1995, 1996, 2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2002, 2003 Free Software Foundation, Inc. Contributed by James Craig Burley. This file is part of GNU Fortran. @@ -591,13 +591,29 @@ tail_recurse: /* :::::::::::::::::::: */ 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); assert (ffeinfo_kindtype (ffebld_info (end)) @@ -608,6 +624,15 @@ tail_recurse: /* :::::::::::::::::::: */ 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)) diff --git a/gcc/f/news.texi b/gcc/f/news.texi index 0d07df41f0a..27edb02dcaa 100644 --- a/gcc/f/news.texi +++ b/gcc/f/news.texi @@ -11,7 +11,7 @@ @c in the standalone derivations of this file (e.g. NEWS). @set copyrights-news 1995,1996,1997,1998,1999,2000,2001,2002,2003 -@set last-update-news 2003-03-24 +@set last-update-news 2003-04-11 @ifset DOC-NEWS @include root.texi @@ -164,6 +164,8 @@ Nothing yet. @item Problem Reports fixed (in chronological order of submission): @table @code +@item 1832 +-list directed i/o overflow hangs, -fbounds-check doesn't detect @item 3924 g77 generates code which is rejected by GAS if COFF debugging info is requested @@ -191,6 +193,8 @@ Incorrect output with 0-based array of characters Double complex zero ** double precision number -> NaN instead of zero @item 9038 -ffixed-line-length-none -x f77-cpp-input gives: Warning: unknown register name line-length-none +@item 9263 +ICE caused by invalid PARAMETER in implied DO loop @item 10197 Direct access files not unformatted by default @end table diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7c1e3bc3505..99bfa5fce9f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2003-04-11 Bud Davis + + PR Fortran/9263 + * g77.f-torture/noncompile/9263.f: New test + PR Fortran/1832 + * g77.f-torture/execute/1832.f: New test + 2003-04-11 David Chad Loren J. Rittle diff --git a/gcc/testsuite/g77.f-torture/execute/1832.f b/gcc/testsuite/g77.f-torture/execute/1832.f new file mode 100644 index 00000000000..9ae1ca9fb27 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/1832.f @@ -0,0 +1,8 @@ + character*120 file + character*5 string + file = "c:/dos/adir/bdir/cdir/text.doc" + write(string, *) "a ", file + if (string .ne. ' a') call abort +C-- The leading space is normal for list-directed output +C-- "file" is not printed because it would overflow "string". + end diff --git a/gcc/testsuite/g77.f-torture/noncompile/9263.f b/gcc/testsuite/g77.f-torture/noncompile/9263.f new file mode 100644 index 00000000000..e68b3e0a65f --- /dev/null +++ b/gcc/testsuite/g77.f-torture/noncompile/9263.f @@ -0,0 +1,7 @@ + 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 INTEGER + DATA (D(I),I=Q,10) /10*10/ ! START NOT INTEGER + DATA (E(I),I=1,10,Q) /10*10/ ! INCREMENT NOT INTEGER + END diff --git a/libf2c/ChangeLog b/libf2c/ChangeLog index be091247888..81741ddbe14 100644 --- a/libf2c/ChangeLog +++ b/libf2c/ChangeLog @@ -1,3 +1,9 @@ +2003-04-11 Bud Davis + + PR Fortran/1832 + * libf2c/libI77/iio.c (z_putc): Check for overflowing length + of output string. + 2003-03-24 Bud Davis PR fortran/10197 diff --git a/libf2c/libI77/iio.c b/libf2c/libI77/iio.c index 69f215425db..940cbf82f91 100644 --- a/libf2c/libI77/iio.c +++ b/libf2c/libI77/iio.c @@ -21,7 +21,7 @@ z_getc (void) void z_putc (int c) { - if (f__icptr < f__icend && f__recpos++ < f__svic->icirlen) + if (f__recpos++ < f__svic->icirlen && f__icptr < f__icend) *f__icptr++ = c; } int