gfortran: alignment data in derived type

Юрий Юрьевич dr.yuri92@gmail.com
Mon Jan 29 21:43:00 GMT 2018


Question is about GFortran compiler behaviour. I use derived type in my
project with declaration like below:

Type :: mytype

    Integer*4 :: ivar         ! the initial point with address "0"
    Real*4 :: farray(20)   ! an array with adresses from "4" to "80"
    .... 4-byte pad
    Integer*8 :: livar        ! the adress of integer*8 variable 88 in this
case

end  Type  mytype

But if change my declaration in such way i get:

Type :: mytype
    ! add above three variables
    Logical*1 :: key1,key2 ! initial point here  with address "0"
    Integer*2 :: i2testvar !  adress 2 as expected
    Integer*4 :: ivar         ! address "4"
    Real*4 :: farray(20)   ! an array with adresses from "8" to "84"
    .... 0-byte pad
    Integer*8 :: livar        ! the adress of integer*8 variable 88 the
same with above declaration

end  Type  mytype

Question: Could I manage the compiler alignment behaviour like in COMMON
Block in old style Fortran and where have been lost the padding?
Best regards and would like get any answer on my question.



More information about the Gcc-help mailing list