| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-Wsurprising" } |
| 3 |
! PR 37221 - also warn about too-long MOLD for TRANSFER if not simplifying. |
| 4 |
! Test case based on contribution by Tobias Burnus. |
| 5 |
program main |
| 6 |
character(len=10) :: str |
| 7 |
integer :: i |
| 8 |
str = transfer(65+66*2**8+67*2**16+68*2**24,str) ! { dg-warning "has partly undefined result" } |
| 9 |
write (*,*) str(1:4) |
| 10 |
i = 65+66*2**8+67*2**16+68*2**24 |
| 11 |
str = transfer(i,str) ! { dg-warning "has partly undefined result" } |
| 12 |
write (*,*) str(1:4) |
| 13 |
str = transfer(i,str(1:4)) |
| 14 |
write (*,*) str(1:4) |
| 15 |
end program |
| 16 |
|