| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fcheck=bounds -g" } |
| 3 |
! { dg-output "At line 18 .*" } |
| 4 |
! { dg-shouldfail "Different CHARACTER lengths (32/0) in array constructor" } |
| 5 |
! |
| 6 |
! PR fortran/70231 - CHARACTER lengths in array constructors |
| 7 |
|
| 8 |
program p |
| 9 |
implicit none |
| 10 |
integer, parameter :: char_len = 32 |
| 11 |
integer :: l = 0 |
| 12 |
character(char_len) :: ch = "a" |
| 13 |
character(char_len), allocatable :: ch_array(:), res1(:), res2(:) |
| 14 |
|
| 15 |
allocate(ch_array(0)) |
| 16 |
res1 = [ ch_array, ch ] ! was false positive |
| 17 |
print *, res1 |
| 18 |
res2 = [[ch_array, ch(1:l)], ch(1:l)] ! was false negative on x86 |
| 19 |
print *, res2 |
| 20 |
end |