[all-commits] [llvm/llvm-project] b15f93: [flang] Add kind-preservation regression tests (#2...

Eugene Epshteyn via All-commits all-commits at lists.llvm.org
Mon Jul 13 20:56:55 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b15f9326d21cbd05463fcb34d989bae95982cc9b
      https://github.com/llvm/llvm-project/commit/b15f9326d21cbd05463fcb34d989bae95982cc9b
  Author: Eugene Epshteyn <eepshteyn at nvidia.com>
  Date:   2026-07-13 (Mon, 13 Jul 2026)

  Changed paths:
    A flang/test/Evaluate/fold-kind-logical.f90
    A flang/test/Evaluate/fold-kind-substring.f90
    A flang/test/Evaluate/fold-kind-zero-size.f90
    M flang/test/Evaluate/logical-args.f90
    A flang/test/Lower/HLFIR/array-ctor-character-kind.f90
    A flang/test/Semantics/modfile84.F90
    A flang/test/Semantics/substring-literal-kind.f90

  Log Message:
  -----------
  [flang] Add kind-preservation regression tests (#208760)

These tests pin currently-correct behaviors where the KIND type
parameter of a result must be preserved by constant folding, semantics,
and lowering. They all pass at head; their purpose is to guard against
silent kind loss during future refactoring of the Evaluate library's
type-parameterized machinery (see the discussion on PR #206907, where an
experimental rewrite passed check-flang while dropping kinds in several
places).

Folded LOGICAL operations: `.NOT./.AND./.OR./.EQV./.NEQV.` keep their
operand kind; ANY/ALL/PARITY and logical DOT_PRODUCT results have the
MASK/argument kind (F2023 16.9.14/16.9.16/16.9.148), including for empty
masks where there is no element value to take a kind from; MERGE and
TRANSFER keep the TSOURCE/MOLD kind; STORAGE_SIZE of folded
non-default-kind logicals folds to the right value; the default BOUNDARY
fill element of a folded EOSHIFT has the array's kind; relational
results are default logical regardless of operand kinds; and generic
resolution over LOGICAL kinds is unchanged by folding
(flang/test/Evaluate/fold-kind-logical.f90 and an extension of
flang/test/Evaluate/logical-args.f90).

Empty typed array constructors and zero-size PACK/SPREAD/RESHAPE/UNPACK
results keep the kind (and character length) of their type-spec (F2023
7.8), including across a module file into a separately compiled
consumer, and empty non-default-kind character array constructors lower
with the correct `!fir.char` element type
(flang/test/Evaluate/fold-kind-zero-size.f90,
flang/test/Semantics/modfile84.F90,
flang/test/Lower/HLFIR/array-ctor-character-kind.f90).

A substring of a character literal has the kind of the literal (F2023
9.4.1): KIND() and LEN() fold correctly, and concatenation with a
same-kind literal is accepted
(flang/test/Evaluate/fold-kind-substring.f90,
flang/test/Semantics/substring-literal-kind.f90).

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