re PR fortran/37203 (Check ORDER= of RESHAPE)

2009-06-06  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/37203
        * simplify.c (gfc_simplify_reshape): Fixed reshaping of empty
        * arrays
        without padding.

2009-06-06  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/37203
        * reshape_zerosize_2.f90: New.

From-SVN: r148238
This commit is contained in:
Daniel Franke 2009-06-06 17:09:57 -04:00 committed by Tobias Burnus
parent 7ba8c18c1e
commit f7cfd28c03
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2009-06-06 Daniel Franke <franke.daniel@gmail.com>
PR fortran/37203
* simplify.c (gfc_simplify_reshape): Fixed reshaping of empty arrays
without padding.
2009-06-06 Daniel Franke <franke.daniel@gmail.com>
PR fortran/32890

View File

@ -3808,7 +3808,7 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp,
for (i = 0; i < rank; i++)
x[i] = 0;
for (;;)
while (nsource > 0 || npad > 0)
{
/* Figure out which element to extract. */
mpz_set_ui (index, 0);

View File

@ -1,3 +1,8 @@
2009-06-06 Daniel Franke <franke.daniel@gmail.com>
PR fortran/37203
* reshape_zerosize_2.f90: New.
2009-06-06 Daniel Franke <franke.daniel@gmail.com>
PR fortran/32890

View File

@ -0,0 +1,11 @@
! { dg-do "run" }
! Simplifier of RESHAPE was broken when reshaping an empty array.
INTEGER, PARAMETER :: empty(0,0) = RESHAPE(SHAPE(1), (/0, 0/))
! same with surplus padding
INTEGER, PARAMETER :: empty_padding(0,0) = RESHAPE(SHAPE(1), (/0, 0/), PAD=( (/ 1, 2 /) ))
! same with required padding
INTEGER, PARAMETER :: non_empty(2,2) = RESHAPE(SHAPE(1), (/2, 2/), PAD=( (/ 1, 2 /) ))
END