6.1.15 Character conversion

Allowing character literals to be used in a similar way to Hollerith constants is a non-standard extension. This feature is enabled using -fdec-char-conversions and only applies to character literals of kind=1.

Character literals can be used in DATA statements and assignments with numeric (INTEGER, REAL, or COMPLEX) or LOGICAL variables. Like Hollerith constants they are copied byte-wise fashion. The constant will be padded with spaces or truncated to fit the size of the variable in which it is stored.

Examples:

integer*4 x
data x / 'abcd' /

x = 'A'       ! Will be padded.
x = 'ab1234'  ! Will be truncated.

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gfortran/Character-conversion.html