gcc/testsuite/gfortran.dg/char_pointer_assign_2.f90
raw| 1 | ! { dg-do compile } |
| 2 | ! Tests the fix for PRs20895 and 25030, where pointer assignments |
| 3 | ! of different length characters were accepted. |
| 4 | character(4), target :: ch1(2) |
| 5 | character(4), pointer :: ch2(:) |
| 6 | character(5), pointer :: ch3(:) |
| 7 | |
| 8 | ch2 => ch1 ! Check correct is OK |
| 9 | ch3 => ch1 ! { dg-error "Unequal character lengths \\(5/4\\)" } |
| 10 | |
| 11 | end |