| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fdump-tree-original" } |
| 3 |
! |
| 4 |
! PR fortran/56650 |
| 5 |
! PR fortran/36437 |
| 6 |
! |
| 7 |
module m |
| 8 |
use iso_c_binding, only: c_sizeof, c_int |
| 9 |
implicit none |
| 10 |
|
| 11 |
integer(c_int), bind(C) :: MPI_Status_C_obj |
| 12 |
integer,parameter :: MPI_STATUS_SIZE = c_sizeof(MPI_Status_C_obj) |
| 13 |
end module m |
| 14 |
|
| 15 |
module m2 |
| 16 |
use iso_c_binding, only: c_sizeof, c_int |
| 17 |
implicit none |
| 18 |
|
| 19 |
integer(c_int), bind(C) :: MPI_Status_C_obj2 |
| 20 |
integer,parameter :: MPI_STATUS_SIZE2 & |
| 21 |
= c_sizeof(MPI_Status_C_obj2)*8/bit_size(0) |
| 22 |
end module m2 |
| 23 |
|
| 24 |
subroutine test() |
| 25 |
use m |
| 26 |
use m2 |
| 27 |
integer :: m1test, m2test |
| 28 |
m1test = MPI_STATUS_SIZE |
| 29 |
m2test = MPI_STATUS_SIZE2 |
| 30 |
end subroutine test |
| 31 |
|
| 32 |
type t |
| 33 |
character(len=20) :: str |
| 34 |
end type t |
| 35 |
type(t):: x(5) |
| 36 |
integer :: iii, jjj |
| 37 |
iii = sizeof (x) ! 5*20 (whole size in bytes) |
| 38 |
jjj = storage_size (x) ! 8*20 (element size in bits) |
| 39 |
end |
| 40 |
|
| 41 |
! { dg-final { scan-tree-dump-times "m1test = 4;" 1 "original" } } |
| 42 |
! { dg-final { scan-tree-dump-times "m2test = 1;" 1 "original" } } |
| 43 |
! { dg-final { scan-tree-dump-times "iii = 100;" 1 "original" } } |
| 44 |
! { dg-final { scan-tree-dump-times "jjj = 160;" 1 "original" } } |