The following sections provide additional details about how the -qautodbl option works, to allow you to predict what happens during promotion and padding.
The storage relationship between two data objects determines the relative starting addresses and the relative sizes of the objects. The -qautodbl option tries to preserve this relationship as much as possible.
Data objects can also have a value relationship, which determines how changes to one object affect another. For example, a program might store a value into one variable, and then read the value through a different storage-associated variable. With -qautodbl in effect, the representation of one or both variables might be different, so the value relationship is not always preserved.
An object that is affected by this option may be:
Space added for padding ensures that the storage-sharing relationship that existed before conversion is maintained. For example, if array elements I(20) and R(10) start at the same address by default and if the elements of R are promoted and become twice as large, the elements of I are padded so that I(20) and R(10) still start at the same address.
Except for unformatted I/O statements, which read and write any padding that is present within structures, I/O statements do not process padding.
The examples in this section illustrate storage-sharing relationships between the following types of entities:
Figure 6. Storage Relationships without the -qautodbl Option
The figure above illustrates the default storage-sharing relationship of the compiler.
@process autodbl(none) block data complex(4) x8 /(1.123456789e0,2.123456789e0)/ real(16) r16(2) /1.123q0,2.123q0/ integer(8) i8(2) /1000,2000/ character*5 c(2) /"abcde","12345"/ common /named/ x8,r16,i8,c end subroutine s() complex(4) x8 real(16) r16(2) integer(8) i8(2) character*5 c(2) common /named/ x8,r16,i8,c ! x8 = (1.123456e0,2.123456e0) ! promotion did not occur ! r16(1) = 1.123q0 ! no padding ! r16(2) = 2.123q0 ! no padding ! i8(1) = 1000 ! no padding ! i8(2) = 2000 ! no padding ! c(1) = "abcde" ! no padding ! c(2) = "12345" ! no padding end subroutine s
Figure 7. Storage Relationships with -qautodbl=dbl
@process autodbl(dbl) block data complex(4) x8 real(16) r16(2) /1.123q0,2.123q0/ real(8) r8 real(4) r4 /1.123456789e0/ integer(8) i8(2) /1000,2000/ character*5 c(2) /"abcde","12345"/ equivalence (x8,r8) common /named/ r16,i8,c,r4 ! Storage relationship between r8 and x8 is preserved. ! Data values are NOT preserved between r8 and x8. end subroutine s() real(16) r16(2) real(8) r4 integer(8) i8(2) character*5 c(2) common /named/ r16,i8,c,r4 ! r16(1) = 1.123q0 ! no padding ! r16(2) = 2.123q0 ! no padding ! r4 = 1.123456789d0 ! promotion occurred ! i8(1) = 1000 ! no padding ! i8(2) = 2000 ! no padding ! c(1) = "abcde" ! no padding ! c(2) = "12345" ! no padding end subroutine s
Figure 8. Storage Relationships with -qautobl=dbl4
@process autodbl(dbl4) complex(8) x16 /(1.123456789d0,2.123456789d0)/ complex(4) x8 real(4) r4(2) equivalence (x16,x8,r4) ! Storage relationship between r4 and x8 is preserved. ! Data values between r4 and x8 are preserved. ! x16 = (1.123456789d0,2.123456789d0) ! promotion did not occur ! x8 = (1.123456789d0,2.123456789d0) ! promotion occurred ! r4(1) = 1.123456789d0 ! promotion occurred ! r4(2) = 2.123456789d0 ! promotion occurred end
Figure 9. Storage Relationships with -qautodbl=dbl8
@process autodbl(dbl8) complex(8) x16 /(1.123456789123456789d0,2.123456789123456789d0)/ complex(4) x8 real(8) r8(2) equivalence (x16,x8,r8) ! Storage relationship between r8 and x16 is preserved. ! Data values between r8 and x16 are preserved. ! x16 = (1.123456789123456789q0,2.123456789123456789q0) ! ! promotion occurred ! x8 = upper 8 bytes of r8(1) ! promotion did not occur ! r8(1) = 1.123456789123456789q0 ! promotion occurred ! r8(2) = 2.123456789123456789q0 ! promotion occurred end
Figure 10. Storage Relationships with -qautodbl=dblpad4
In the figure above, the dashed lines represent the padding.
@process autodbl(dblpad4) complex(8) x16 /(1.123456789d0,2.123456789d0)/ complex(4) x8 real(4) r4(2) integer(8) i8(2) equivalence(x16,x8,r4,i8) ! Storage relationship among all entities is preserved. ! Date values between x8 and r4 are preserved. ! x16 = (1.123456789d0,2.123456789d0) ! padding occurred ! x8 = (upper 8 bytes of x16, 8 byte pad) ! promotion occurred ! r4(1) = real(x8) ! promotion occurred ! r4(2) = imag(x8) ! promotion occurred ! i8(1) = real(x16) ! padding occurred ! i8(2) = imag(x16) ! padding occurred end
Figure 11. Storage Relationships with -qautodbl=dblpad8
In the figure above, the dashed lines represent the padding.
@process autodbl(dblpad8) complex(8) x16 /(1.123456789123456789d0,2.123456789123456789d0)/ complex(4) x8 real(8) r8(2) integer(8) i8(2) byte b(16) equivalence (x16,x8,r8,i8,b) ! Storage relationship among all entities is preserved. ! Data values between r8 and x16 are preserved. ! Data values between i8 and b are preserved. ! x16 = (1.123456789123456789q0,2.123456789123456789q0) ! ! promotion occurred ! x8 = upper 8 bytes of r8(1) ! padding occurred ! r8(1) = real(x16) ! promotion occurred ! r8(2) = imag(x16) ! promotion occurred ! i8(1) = upper 8 bytes of real(x16) ! padding occurred ! i8(2) = upper 8 bytes of imag(x16) ! padding occurred ! b(1:8)= i8(1) ! padding occurred ! b(9:16)= i8(2) ! padding occurred end
Figure 12. Storage Relationships with -qautodbl=dblpad
In the figure above, the dashed lines represent the padding.
@process autodbl(dblpad) block data complex(4) x8 /(1.123456789e0,2.123456789e0)/ real(16) r16(2) /1.123q0,2.123q0/ integer(8) i8(2) /1000,2000/ character*5 c(2) /"abcde","12345"/ common /named/ x8,r16,i8,c end subroutine s() complex(8) x8 real(16) r16(4) integer(8) i8(4) character*5 c(2) common /named/ x8,r16,i8,c ! x8 = (1.123456789d0,2.123456789d0) ! promotion occurred ! r16(1) = 1.123q0 ! padding occurred ! r16(3) = 2.123q0 ! padding occurred ! i8(1) = 1000 ! padding occurred ! i8(3) = 2000 ! padding occurred ! c(1) = "abcde" ! no padding occurred ! c(2) = "12345" ! no padding occurred end subroutine s