]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. index:: logical, variable representation | |
7 | ||
8 | .. _internal-representation-of-logical-variables: | |
9 | ||
10 | Internal representation of LOGICAL variables | |
11 | ******************************************** | |
12 | ||
13 | The Fortran standard does not specify how variables of ``LOGICAL`` | |
14 | type are represented, beyond requiring that ``LOGICAL`` variables | |
15 | of default kind have the same storage size as default ``INTEGER`` | |
16 | and ``REAL`` variables. The GNU Fortran internal representation is | |
17 | as follows. | |
18 | ||
19 | A ``LOGICAL(KIND=N)`` variable is represented as an | |
20 | ``INTEGER(KIND=N)`` variable, however, with only two permissible | |
21 | values: ``1`` for ``.TRUE.`` and ``0`` for | |
22 | ``.FALSE.``. Any other integer value results in undefined behavior. | |
23 | ||
3ed1b4ce | 24 | See also :ref:`argument-passing-conventions` and :ref:`interoperability-with-c`. |