diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2008-05-14 21:17:54 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2008-05-14 21:17:54 +0000 |
commit | f10827b13be2d7f3a031c93ba6fcc35f81f762fd (patch) | |
tree | d90a1cc6679a260627c1c0176e3a19d8f0be3cf1 /gcc/fortran | |
parent | 71d46ca56cb36baa54ec8a1de7cbc0fda9ae3245 (diff) | |
download | gcc-f10827b13be2d7f3a031c93ba6fcc35f81f762fd.zip gcc-f10827b13be2d7f3a031c93ba6fcc35f81f762fd.tar.gz gcc-f10827b13be2d7f3a031c93ba6fcc35f81f762fd.tar.bz2 |
re PR fortran/35685 (UBOUND incorrect for run-time zero-sized section)
PR fortran/35685
* trans-intrinsic.c (gfc_conv_intrinsic_bound): Correctly
handle zero-size sections.
* gfortran.dg/bound_3.f90: New test.
From-SVN: r135305
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7ed34a6..d478a25 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 2008-05-14 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + PR fortran/35685 + * trans-intrinsic.c (gfc_conv_intrinsic_bound): Correctly + handle zero-size sections. + +2008-05-14 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + PR fortran/36215 * scanner.c (preprocessor_line): Allocate enough memory for a wide string. diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 9f022e7..2f9cadd 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -938,6 +938,8 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper) size = fold_build2 (MINUS_EXPR, gfc_array_index_type, ubound, lbound); se->expr = fold_build2 (PLUS_EXPR, gfc_array_index_type, size, gfc_index_one_node); + se->expr = fold_build2 (MAX_EXPR, gfc_array_index_type, se->expr, + gfc_index_zero_node); } else se->expr = gfc_index_one_node; |