| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-Wzerotrip" } |
| 3 |
! PR34990 ICE in gfc_typenode_for_spec, at fortran/trans-types.c:842 |
| 4 |
! Test case that of the reporters. |
| 5 |
module test |
| 6 |
implicit none |
| 7 |
contains |
| 8 |
function my_string(x) |
| 9 |
integer i |
| 10 |
real, intent(in) :: x(:) |
| 11 |
character(0) h4(1:minval([(1,i=1,0)],1)) ! { dg-warning "will be executed zero times" } |
| 12 |
character(0) sv1(size(x,1):size(h4)) |
| 13 |
character(0) sv2(2*lbound(sv1,1):size(h4)) |
| 14 |
character(lbound(sv2,1)-3) my_string |
| 15 |
|
| 16 |
do i = 1, len(my_string) |
| 17 |
my_string(i:i) = achar(modulo(i-1,10)+iachar('0')) |
| 18 |
end do |
| 19 |
end function my_string |
| 20 |
end module test |
| 21 |
|
| 22 |
program len_test |
| 23 |
use test |
| 24 |
implicit none |
| 25 |
real x(7) |
| 26 |
|
| 27 |
write(*,*) my_string(x) |
| 28 |
end program len_test |