Commit f10827b1 by Francois-Xavier Coudert Committed by François-Xavier Coudert

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
parent 71d46ca5
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.
......
......@@ -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;
......
2008-05-14 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/35685
* gfortran.dg/bound_3.f90: New test.
2008-05-14 Michael Meissner <michael.meissner@amd.com>
Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
! { dg-do run }
!
call s(1,0)
call s(2,0)
call s(3,0)
call s(4,0)
call s(5,1)
call s(6,2)
call s(7,3)
contains
subroutine s(n,m)
implicit none
integer n, m
real x(10)
if (any (lbound(x(5:n)) /= 1)) call abort
if (lbound(x(5:n),1) /= 1) call abort
if (any (ubound(x(5:n)) /= m)) call abort
if (ubound(x(5:n),1) /= m) call abort
end subroutine
end program
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment