diff options
author | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-16 22:29:46 +0000 |
---|---|---|
committer | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-16 22:29:46 +0000 |
commit | e7cf683e32bd972f5612bd4640c37bf60d3b53e6 (patch) | |
tree | 36463b2afe69cf810cf47a28df21f64d27c408bc /gcc/fortran/trans-array.c | |
parent | f4fc810b502218ef2708337c8c791573025d94ca (diff) | |
download | gcc-e7cf683e32bd972f5612bd4640c37bf60d3b53e6.tar.gz |
2006-10-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/20541
* trans-array.c (gfc_trans_array_bounds): Test for and set
negative stride of a non-constant bound array to zero.
PR fortran/29392
* data.c (create_character_intializer): Copy and simplify
the expressions for the start and end of a sub-string
reference.
2006-10-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29392
* gfortran.dg/data_char_3.f90: New test.
PR fortran/20541
* gfortran.dg/negative_automatic_size.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117797 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index ba07f028f8d..6fd93dd3745 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3540,6 +3540,14 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, gfc_add_modify_expr (pblock, stride, tmp); else stride = gfc_evaluate_now (tmp, pblock); + + /* Make sure that negative size arrays are translated + to being zero size. */ + tmp = build2 (GE_EXPR, boolean_type_node, + stride, gfc_index_zero_node); + tmp = build3 (COND_EXPR, gfc_array_index_type, tmp, + stride, gfc_index_zero_node); + gfc_add_modify_expr (pblock, stride, tmp); } size = stride; |