mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
[multiple changes]
2005-06-25 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/22144 * m4/cshift1.m4: Remove const from argument ret. Populate return array descriptor if ret->data is NULL. * m4/eoshift1.m4: Likewise. * m4/eoshift3.m4: Likewise. * generated/cshift1_4.c: Regenerated. * generated/cshift1_8.c: Regenerated. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. 2005-06-25 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/21144 * gfortran.dg/shift-alloc.f90: New testcase. From-SVN: r101318
This commit is contained in:
parent
366ccddb2b
commit
0e6d033bc8
@ -1,3 +1,8 @@
|
||||
2005-06-25 Thomas Koenig <Thomas.Koenig@online.de>
|
||||
|
||||
PR libfortran/21144
|
||||
* gfortran.dg/shift-alloc.f90: New testcase.
|
||||
|
||||
2005-06-25 Kelley Cook <kcook@gcc.gnu.org>
|
||||
|
||||
* all files: Update FSF address in copyright headers.
|
||||
|
18
gcc/testsuite/gfortran.dg/shift-alloc.f90
Normal file
18
gcc/testsuite/gfortran.dg/shift-alloc.f90
Normal file
@ -0,0 +1,18 @@
|
||||
! { dg do-run }
|
||||
! PR 22144: eoshift1, eoshift3 and cshift1 used to lack memory
|
||||
! allocation, which caused the writes to segfault.
|
||||
program main
|
||||
implicit none
|
||||
integer, dimension (:,:),allocatable :: a
|
||||
integer, dimension (3) :: sh, bo
|
||||
character(len=80) line1, line2
|
||||
integer :: i
|
||||
|
||||
allocate (a(3,3))
|
||||
a = reshape((/(i,i=1,9)/),shape(a))
|
||||
sh = (/ 2, -1, -2 /)
|
||||
bo = (/ -3, -2, -1 /)
|
||||
write(unit=line1,fmt='(10I5)') cshift(a, shift=sh)
|
||||
write(unit=line1,fmt='(10I5)') eoshift(a, shift=sh)
|
||||
write(unit=line1,fmt='(10I5)') eoshift(a, shift=sh, boundary=bo)
|
||||
end program main
|
@ -1,3 +1,17 @@
|
||||
2005-06-25 Thomas Koenig <Thomas.Koenig@online.de>
|
||||
|
||||
PR libfortran/22144
|
||||
* m4/cshift1.m4: Remove const from argument ret.
|
||||
Populate return array descriptor if ret->data is NULL.
|
||||
* m4/eoshift1.m4: Likewise.
|
||||
* m4/eoshift3.m4: Likewise.
|
||||
* generated/cshift1_4.c: Regenerated.
|
||||
* generated/cshift1_8.c: Regenerated.
|
||||
* generated/eoshift1_4.c: Regenerated.
|
||||
* generated/eoshift1_8.c: Regenerated.
|
||||
* generated/eoshift3_4.c: Regenerated.
|
||||
* generated/eoshift3_8.c: Regenerated.
|
||||
|
||||
2005-06-24 Jerry DeLisle <jvdelisle@verizon.net>
|
||||
|
||||
PR libfortran/21915
|
||||
|
@ -34,13 +34,13 @@ Boston, MA 02111-1307, USA. */
|
||||
#include <string.h>
|
||||
#include "libgfortran.h"
|
||||
|
||||
void cshift1_4 (const gfc_array_char * ret,
|
||||
void cshift1_4 (gfc_array_char * ret,
|
||||
const gfc_array_char * array,
|
||||
const gfc_array_i4 * h, const GFC_INTEGER_4 * pwhich);
|
||||
export_proto(cshift1_4);
|
||||
|
||||
void
|
||||
cshift1_4 (const gfc_array_char * ret,
|
||||
cshift1_4 (gfc_array_char * ret,
|
||||
const gfc_array_char * array,
|
||||
const gfc_array_i4 * h, const GFC_INTEGER_4 * pwhich)
|
||||
{
|
||||
@ -80,6 +80,25 @@ cshift1_4 (const gfc_array_char * ret,
|
||||
|
||||
size = GFC_DESCRIPTOR_SIZE (ret);
|
||||
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
size = GFC_DESCRIPTOR_SIZE (array);
|
||||
|
@ -34,13 +34,13 @@ Boston, MA 02111-1307, USA. */
|
||||
#include <string.h>
|
||||
#include "libgfortran.h"
|
||||
|
||||
void cshift1_8 (const gfc_array_char * ret,
|
||||
void cshift1_8 (gfc_array_char * ret,
|
||||
const gfc_array_char * array,
|
||||
const gfc_array_i8 * h, const GFC_INTEGER_8 * pwhich);
|
||||
export_proto(cshift1_8);
|
||||
|
||||
void
|
||||
cshift1_8 (const gfc_array_char * ret,
|
||||
cshift1_8 (gfc_array_char * ret,
|
||||
const gfc_array_char * array,
|
||||
const gfc_array_i8 * h, const GFC_INTEGER_8 * pwhich)
|
||||
{
|
||||
@ -80,6 +80,25 @@ cshift1_8 (const gfc_array_char * ret,
|
||||
|
||||
size = GFC_DESCRIPTOR_SIZE (ret);
|
||||
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
size = GFC_DESCRIPTOR_SIZE (array);
|
||||
|
@ -37,14 +37,14 @@ Boston, MA 02111-1307, USA. */
|
||||
static const char zeros[16] =
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
extern void eoshift1_4 (const gfc_array_char *,
|
||||
extern void eoshift1_4 (gfc_array_char *,
|
||||
const gfc_array_char *,
|
||||
const gfc_array_i4 *, const char *,
|
||||
const GFC_INTEGER_4 *);
|
||||
export_proto(eoshift1_4);
|
||||
|
||||
void
|
||||
eoshift1_4 (const gfc_array_char *ret,
|
||||
eoshift1_4 (gfc_array_char *ret,
|
||||
const gfc_array_char *array,
|
||||
const gfc_array_i4 *h, const char *pbound,
|
||||
const GFC_INTEGER_4 *pwhich)
|
||||
@ -95,6 +95,26 @@ eoshift1_4 (const gfc_array_char *ret,
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
size = GFC_DESCRIPTOR_SIZE (array);
|
||||
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
n = 0;
|
||||
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
|
||||
{
|
||||
|
@ -37,14 +37,14 @@ Boston, MA 02111-1307, USA. */
|
||||
static const char zeros[16] =
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
extern void eoshift1_8 (const gfc_array_char *,
|
||||
extern void eoshift1_8 (gfc_array_char *,
|
||||
const gfc_array_char *,
|
||||
const gfc_array_i8 *, const char *,
|
||||
const GFC_INTEGER_8 *);
|
||||
export_proto(eoshift1_8);
|
||||
|
||||
void
|
||||
eoshift1_8 (const gfc_array_char *ret,
|
||||
eoshift1_8 (gfc_array_char *ret,
|
||||
const gfc_array_char *array,
|
||||
const gfc_array_i8 *h, const char *pbound,
|
||||
const GFC_INTEGER_8 *pwhich)
|
||||
@ -95,6 +95,26 @@ eoshift1_8 (const gfc_array_char *ret,
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
size = GFC_DESCRIPTOR_SIZE (array);
|
||||
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
n = 0;
|
||||
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
|
||||
{
|
||||
|
@ -90,6 +90,25 @@ eoshift3_4 (gfc_array_char *ret, gfc_array_char *array,
|
||||
which = 0;
|
||||
|
||||
size = GFC_DESCRIPTOR_SIZE (ret);
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
|
@ -90,6 +90,25 @@ eoshift3_8 (gfc_array_char *ret, gfc_array_char *array,
|
||||
which = 0;
|
||||
|
||||
size = GFC_DESCRIPTOR_SIZE (ret);
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
|
@ -35,13 +35,13 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "libgfortran.h"'
|
||||
include(iparm.m4)dnl
|
||||
|
||||
void cshift1_`'atype_kind (const gfc_array_char * ret,
|
||||
void cshift1_`'atype_kind (gfc_array_char * ret,
|
||||
const gfc_array_char * array,
|
||||
const atype * h, const atype_name * pwhich);
|
||||
export_proto(cshift1_`'atype_kind);
|
||||
|
||||
void
|
||||
cshift1_`'atype_kind (const gfc_array_char * ret,
|
||||
cshift1_`'atype_kind (gfc_array_char * ret,
|
||||
const gfc_array_char * array,
|
||||
const atype * h, const atype_name * pwhich)
|
||||
{
|
||||
@ -81,6 +81,25 @@ cshift1_`'atype_kind (const gfc_array_char * ret,
|
||||
|
||||
size = GFC_DESCRIPTOR_SIZE (ret);
|
||||
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
size = GFC_DESCRIPTOR_SIZE (array);
|
||||
|
@ -38,14 +38,14 @@ include(iparm.m4)dnl
|
||||
static const char zeros[16] =
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
extern void eoshift1_`'atype_kind (const gfc_array_char *,
|
||||
extern void eoshift1_`'atype_kind (gfc_array_char *,
|
||||
const gfc_array_char *,
|
||||
const atype *, const char *,
|
||||
const atype_name *);
|
||||
export_proto(eoshift1_`'atype_kind);
|
||||
|
||||
void
|
||||
eoshift1_`'atype_kind (const gfc_array_char *ret,
|
||||
eoshift1_`'atype_kind (gfc_array_char *ret,
|
||||
const gfc_array_char *array,
|
||||
const atype *h, const char *pbound,
|
||||
const atype_name *pwhich)
|
||||
@ -96,6 +96,26 @@ eoshift1_`'atype_kind (const gfc_array_char *ret,
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
size = GFC_DESCRIPTOR_SIZE (array);
|
||||
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
n = 0;
|
||||
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
|
||||
{
|
||||
|
@ -91,6 +91,25 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array,
|
||||
which = 0;
|
||||
|
||||
size = GFC_DESCRIPTOR_SIZE (ret);
|
||||
if (ret->data == NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * size0 ((array_t *)array));
|
||||
ret->base = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
{
|
||||
ret->dim[i].lbound = 0;
|
||||
ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
|
||||
|
||||
if (i == 0)
|
||||
ret->dim[i].stride = 1;
|
||||
else
|
||||
ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extent[0] = 1;
|
||||
count[0] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user