Fortran Cheat Sheet
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. The reference material consulted while preparing these pages is listed in the section bibliography. |
A single-page, colour-coded summary of modern Fortran and its toolchain, written against Fortran 2023 (ISO/IEC 1539-1:2023, J3/23-007r1; checked 2026-10-19 with GNU Fortran 16.2 and LLVM Flang 23) — the toolchain map with the strict and debug flags and an fpm.toml skeleton, the program skeleton and free-form rules, the five intrinsic types with kinds and the numeric model, operators and precedence, control flow with do concurrent, procedures with intent, optional, pure and elemental, arrays (declarations, sections, constructors, where, reductions, column-major order, allocate and move_alloc), strings, derived types and object-oriented programming, pointers, input/output with the main edit descriptors and namelist, the intrinsic modules, coarrays, OpenMP and MPI, interoperability one-liners for C, f2py and MEX, best practices and gotchas, and a strip of legacy features and their modern replacements — handy for quick memorization or as a downloadable PDF desk reference.
For the full explanation, every option, and additional examples, see the dedicated pages:
Start here — Fortran Reference.
Getting started — Getting Started, History, Standards and Compilers and Fortran for Programmers of Other Languages.
Core language — Program Structure and Source Form, Intrinsic Types and Kinds, Variables, Declarations and Attributes, Expressions and Assignment, Control Flow, Procedures, Functions and Subroutines, Modules and Submodules and Interfaces, Generics and Operator Overloading.
Arrays — Arrays Fundamentals, Allocatable Arrays and Dynamic Memory, Array Arguments: Assumed Shape, Size and Rank, Array Intrinsics and Reductions and Generic and Rank Independent Programming.
Characters, strings and pointers — Characters and Strings and Pointers and Targets.
Derived types and object-oriented programming — Derived Types, Parameterized Derived Types, Object Oriented Programming, Type-Bound Procedures, Abstract Types and Finalization and Enumerations.
Input/output — Input/Output: Units and Files, Format Specifications and Edit Descriptors, Internal Files, Namelist and Non-Advancing I/O and Derived-Type and Asynchronous I/O.
Intrinsics, numerics and errors — Intrinsic Procedures Overview, Numeric Model, Bit Manipulation and Conversion, Intrinsic Modules and iso_fortran_env, Floating-Point and IEEE Arithmetic and Error Handling and Program Termination.
Parallel programming — Coarrays, Images and Synchronization, Coarray Teams, Events, Collectives and Atomics, do concurrent and GPU Offload, OpenMP and OpenACC and MPI with mpi_f08.
Interoperability — Interoperability with C, C Descriptors and ISO_Fortran_binding, Calling Fortran from C, C++ and Python and MATLAB: MEX, Engine and MAT-File APIs.
Tooling and ecosystem — Compilers and Compiler Options, Building with Make, CMake and Meson, Fortran Package Manager (fpm), Fortran stdlib, BLAS, LAPACK and Numerical Libraries, Testing, Debugging and Profiling and Documentation and Editor Tooling.
Practice and modernization — Best Practices and Style, Common Gotchas and Pitfalls, Performance and Memory Layout and Legacy Features and Modernization.
Evolution and reference — What’s New and Fortran 2028 Preview.
References
The PDF summarizes the official documentation; each source is cited in full on the page listed above that covers it, and in the section bibliography.