diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-02-03 13:38:42 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-02-03 13:38:42 +0000 |
commit | 36f7dcae093c3ed596010a4bf88ce731a7d6236e (patch) | |
tree | 3f6806872e565af6ccf3b61138274516caa9cd46 /gcc/fortran/array.c | |
parent | 75b1b789dd6b3d3ad5c950a4911d49ed29a9cec4 (diff) | |
download | gcc-36f7dcae093c3ed596010a4bf88ce731a7d6236e.zip gcc-36f7dcae093c3ed596010a4bf88ce731a7d6236e.tar.gz gcc-36f7dcae093c3ed596010a4bf88ce731a7d6236e.tar.bz2 |
re PR fortran/30514 ([4.1 only] zero-sized array wrongly rejected: integer :: i(1:-1))
2007-02-03 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30514
* array.c (match_array_element_spec): If the length of an array is
negative, adjust the upper limit to make it zero length.
PR fortran/30660
* resolve.c (pure_function, resolve_function): Initialize name to
null to clear up build warnings.
(resolve_fl_variable): Look at components explicitly to check for
default initializer, rather than using gfc_default_initializer.
2007-02-03 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30514
* gfortran.dg/zero_sized_2.f90: New test.
PR fortran/30660
* gfortran.dg/alloc_comp_basics_4.f90: New test.
PR fortran/29820
* gfortran.dg/actual_array_interface_1.f90: Copy source to empty
file.
From-SVN: r121541
Diffstat (limited to 'gcc/fortran/array.c')
-rw-r--r-- | gcc/fortran/array.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 76dee50..895bccc 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -319,6 +319,15 @@ match_array_element_spec (gfc_array_spec *as) if (m == MATCH_NO) return AS_ASSUMED_SHAPE; + /* If the size is negative in this dimension, set it to zero. */ + if ((*lower)->expr_type == EXPR_CONSTANT + && (*upper)->expr_type == EXPR_CONSTANT + && mpz_cmp ((*upper)->value.integer, (*lower)->value.integer) < 0) + { + gfc_free_expr (*upper); + *upper = gfc_copy_expr (*lower); + mpz_sub_ui ((*upper)->value.integer, (*upper)->value.integer, 1); + } return AS_EXPLICIT; } |