From 8e249b232d0538f19b6e76ef6f29ba21f2404611 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sat, 30 Apr 2005 20:51:39 +0000 Subject: [PATCH] re PR libfortran/18958 ([4.0 only] eoshift segfaults when shifting off the end of an array) 2005-04-30 Thomas Koenig PR libfortran/18958 libgfortran.h: Change typedef of index_type from size_t to ssize_t. 2005-04-30 Thomas Koenig PR libfortran/18958 * gfortran.dg/eoshift.f90: New test case. From-SVN: r99047 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/eoshift.f90 | 6 ++++++ libgfortran/ChangeLog | 6 ++++++ libgfortran/libgfortran.h | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/eoshift.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 745c92c3ecee..00edc96465e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-30 Thomas Koenig + + PR libfortran/18958 + * gfortran.dg/eoshift.f90: New test case. + 2005-04-30 Paul Thomas PR libfortran/18857 diff --git a/gcc/testsuite/gfortran.dg/eoshift.f90 b/gcc/testsuite/gfortran.dg/eoshift.f90 new file mode 100644 index 000000000000..bb1cba4712d1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/eoshift.f90 @@ -0,0 +1,6 @@ +! { dg-do run } +! PR 18958: We used to segfault for eoshifting off the end of an array. +program main + character(len=20) line + write (line,'(I4)') eoshift((/1, 3/), 3) +end program main diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 64a32041b59c..fe1ebfe7bdb4 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2005-04-30 Thomas Koenig + + PR libfortran/18958 + libgfortran.h: Change typedef of index_type from size_t + to ssize_t. + 2005-04-30 Paul Thomas PR libfortran/18857 diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 7dd6993809f0..c525fad7a2e3 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -215,7 +215,7 @@ typedef complex double GFC_COMPLEX_8; /* The following two definitions must be consistent with the types used by the compiler. */ /* The type used of array indices, amongst other things. */ -typedef size_t index_type; +typedef ssize_t index_type; /* The type used for the lengths of character variables. */ typedef GFC_INTEGER_4 gfc_charlen_type; -- 2.47.2