re PR libfortran/38225 (RESHAPE bounds with multi-dimensional SOURCE)
2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/38225 * intrinsics/reshape_generic.c (reshape_internal): Use all dimensions of source for bounds checking. * m4/reshape.m4: Likewise. * generated/reshape_c10.c Regenerated. * generated/reshape_c16.c Regenerated. * generated/reshape_c4.c Regenerated. * generated/reshape_c8.c Regenerated. * generated/reshape_i16.c Regenerated. * generated/reshape_i4.c Regenerated. * generated/reshape_i8.c Regenerated. * generated/reshape_r10.c Regenerated. * generated/reshape_r16.c Regenerated. * generated/reshape_r4.c Regenerated. * generated/reshape_r8.c Regenerated. 2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/38225 * gfortran.dg/reshape_3.f90: New test. From-SVN: r142125
This commit is contained in:
parent
2ec855f1f7
commit
a388c77976
@ -1,3 +1,8 @@
|
||||
2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR libfortran/38225
|
||||
* gfortran.dg/reshape_3.f90: New test.
|
||||
|
||||
2008-11-22 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/38160
|
||||
|
12
gcc/testsuite/gfortran.dg/reshape_3.f90
Normal file
12
gcc/testsuite/gfortran.dg/reshape_3.f90
Normal file
@ -0,0 +1,12 @@
|
||||
! { dg-do run }
|
||||
! { dg-options "-fbounds-check" }
|
||||
program main
|
||||
implicit none
|
||||
integer, dimension(2,2) :: a4
|
||||
integer(kind=1), dimension(2,2) :: a1
|
||||
character(len=100) line
|
||||
data a4 /1, 2, 3, 4/
|
||||
a1 = a4
|
||||
write (unit=line,fmt='(4I3)') reshape(a4,(/4/))
|
||||
write (unit=line,fmt='(4I3)') reshape(a1,(/4/))
|
||||
end program main
|
@ -1,3 +1,21 @@
|
||||
2008-11-22 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR libfortran/38225
|
||||
* intrinsics/reshape_generic.c (reshape_internal):
|
||||
Use all dimensions of source for bounds checking.
|
||||
* m4/reshape.m4: Likewise.
|
||||
* generated/reshape_c10.c Regenerated.
|
||||
* generated/reshape_c16.c Regenerated.
|
||||
* generated/reshape_c4.c Regenerated.
|
||||
* generated/reshape_c8.c Regenerated.
|
||||
* generated/reshape_i16.c Regenerated.
|
||||
* generated/reshape_i4.c Regenerated.
|
||||
* generated/reshape_i8.c Regenerated.
|
||||
* generated/reshape_r10.c Regenerated.
|
||||
* generated/reshape_r16.c Regenerated.
|
||||
* generated/reshape_r4.c Regenerated.
|
||||
* generated/reshape_r8.c Regenerated.
|
||||
|
||||
2008-11-22 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR libfortran/37839
|
||||
|
@ -135,7 +135,14 @@ reshape_c10 (gfc_array_c10 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_c16 (gfc_array_c16 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_c4 (gfc_array_c4 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_c8 (gfc_array_c8 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_16 (gfc_array_i16 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_4 (gfc_array_i4 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_8 (gfc_array_i8 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_r10 (gfc_array_r10 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_r16 (gfc_array_r16 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_r4 (gfc_array_r4 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -135,7 +135,14 @@ reshape_r8 (gfc_array_r8 * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -124,7 +124,14 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
@ -139,7 +139,14 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
|
||||
(long int) ret_extent, (long int) shape_data[n]);
|
||||
}
|
||||
|
||||
source_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent = 1;
|
||||
sdim = GFC_DESCRIPTOR_RANK (source);
|
||||
for (n = 0; n < sdim; n++)
|
||||
{
|
||||
index_type se;
|
||||
se = source->dim[n].ubound + 1 - source->dim[0].lbound;
|
||||
source_extent *= se > 0 ? se : 0;
|
||||
}
|
||||
|
||||
if (rs < source_extent || (rs > source_extent && !pad))
|
||||
runtime_error("Incorrect size in SOURCE argument to RESHAPE"
|
||||
|
Loading…
x
Reference in New Issue
Block a user