OSDN Git Service

2003-04-11 Bud Davis <bdavis9659@comcast.net>
authortoon <toon@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Apr 2003 21:33:48 +0000 (21:33 +0000)
committertoon <toon@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Apr 2003 21:33:48 +0000 (21:33 +0000)
PR Fortran/9263
* gcc/f/data.c (ffedata_advance_): Check initial, final and
increment values for INTEGER typeness.
PR Fortran/1832
* libf2c/libI77/iio.c (z_putc): Check for overflowing length
of output string.
* gcc/f/news.texi: Document these fixes.
PR Fortran/9263
* g77.f-torture/noncompile/9263.f: New test
PR Fortran/1832
* g77.f-torture/execute/1832.f: New test

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65481 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/f/ChangeLog
gcc/f/data.c
gcc/f/news.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g77.f-torture/execute/1832.f [new file with mode: 0644]
gcc/testsuite/g77.f-torture/noncompile/9263.f [new file with mode: 0644]
libf2c/ChangeLog
libf2c/libI77/iio.c

index 14f1b84..d6ff719 100644 (file)
@@ -1,3 +1,10 @@
+2003-04-11  Bud Davis <bdavis9659@comcast.net>
+
+       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  <steven@gcc.gnu.org>
 
        * ffe.texi: Don't mention dead file proj.c.
index 3e1ae62..91b835d 100644 (file)
@@ -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))
index 0d07df4..27edb02 100644 (file)
@@ -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
index 7c1e3bc..99bfa5f 100644 (file)
@@ -1,3 +1,10 @@
+2003-04-11  Bud Davis <bdavis9659@comcast.net>
+
+       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  <davidc@freebsd.org>
            Loren J. Rittle  <ljrittle@acm.org>
 
diff --git a/gcc/testsuite/g77.f-torture/execute/1832.f b/gcc/testsuite/g77.f-torture/execute/1832.f
new file mode 100644 (file)
index 0000000..9ae1ca9
--- /dev/null
@@ -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 (file)
index 0000000..e68b3e0
--- /dev/null
@@ -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
index be09124..81741dd 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-11  Bud Davis <bdavis9659@comcast.net>
+
+       PR Fortran/1832
+       * libf2c/libI77/iio.c (z_putc): Check for overflowing length
+       of output string.
+
 2003-03-24  Bud Davis  <bdavis9659@comcast.net>
 
        PR fortran/10197
index 69f2154..940cbf8 100644 (file)
@@ -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