Hi,

I've just notice a strange behavior of the fortran 2008 "storage_size" procedure when applied to simple derived-type variables.

If a derived-type is defined with only scalar variables, then the storage size of this derived-type is larger than the sum of the storage sizes of each individual components.

The above program,

Program Main implicit none type :: My_Type logical :: l0 integer :: i0 real(4) :: s0 real(8) :: d0 end type type(My_Type) :: Var write(*,"('Starting')") write(*,"('Storage_Size(Var%l0) = ',g0)") Storage_Size(Var%l0) write(*,"('Storage_Size(Var%i0) = ',g0)") Storage_Size(Var%i0) write(*,"('Storage_Size(Var%s0) = ',g0)") Storage_Size(Var%s0) write(*,"('Storage_Size(Var%d0) = ',g0)") Storage_Size(Var%d0) write(*,"('SUM Storage_Size(Var%*) = ',g0)") Storage_Size(Var%l0) + Storage_Size(Var%i0) +Storage_Size(Var%s0) + Storage_Size(Var%d0) write(*,"('Storage_Size(Var) = ',g0)") Storage_Size(Var) write(*,"('Ending')") End Program

gives the following result:

$ ifort main.f90; ./a.out Starting Storage_Size(Var%l0) = 32 Storage_Size(Var%i0) = 32 Storage_Size(Var%s0) = 32 Storage_Size(Var%d0) = 64 SUM Storage_Size(Var%*) = 160 Storage_Size(Var) = 192 Ending

Why such a behavior ? Is there some hidden data stored somewhere in the derived-type ?