[all-commits] [llvm/llvm-project] 40ad00: [flang] Define array named constants from the iso_...
mleair via All-commits
all-commits at lists.llvm.org
Tue Jun 2 14:44:51 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 40ad00beb3e275e1c50d6a718800d197a6b02c4e
https://github.com/llvm/llvm-project/commit/40ad00beb3e275e1c50d6a718800d197a6b02c4e
Author: mleair <leairmark at gmail.com>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M flang/lib/Lower/Bridge.cpp
A flang/test/Lower/intrinsic-module-array-constant.f90
Log Message:
-----------
[flang] Define array named constants from the iso_fortran_env intrins… (#201190)
…ic module
createIntrinsicModuleDefinitions() only emitted definitions for array
named constants belonging to the __fortran_ieee_exceptions intrinsic
module. Array constants declared directly in the iso_fortran_env
intrinsic module -- in practice character_kinds -- were therefore only
lowered as bodyless `fir.global` external declarations at their use site
and never defined anywhere, producing an undefined reference at link
time.
This is usually hidden because scalar iso_fortran_env parameters fold to
immediates and constant-shape array accesses are folded away, so the
dangling external symbol is DCE'd before linking. It surfaces when the
address of the array genuinely escapes to runtime, e.g.:
```
use iso_fortran_env
integer :: i, x(1)
do i = 1, size(character_kinds)
x = findloc(character_kinds, character_kinds(i))
end do
```
which fails with:
undefined reference to `_QMiso_fortran_envECcharacter_kinds'
Fix by also processing the iso_fortran_env scope in
createIntrinsicModuleDefinitions(), so its array constants are emitted
as linkonce_odr definitions with initializers.
Note that integer_kinds/real_kinds/logical_kinds are unaffected: they
are renamed from iso_fortran_env_impl, a non-intrinsic module that is
compiled into the runtime, so their definitions already exist there.
Assisted-by: AI
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list