[all-commits] [llvm/llvm-project] fcec9c: [flang] Do not error on constant nonzero UB in sub...

TMJ via All-commits all-commits at lists.llvm.org
Thu Jan 8 10:29:10 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fcec9ced47c5b1e2479fa86f7b51a73ba6feb3f7
      https://github.com/llvm/llvm-project/commit/fcec9ced47c5b1e2479fa86f7b51a73ba6feb3f7
  Author: TMJ <tedmjohnson at protonmail.com>
  Date:   2026-01-08 (Thu, 08 Jan 2026)

  Changed paths:
    M flang/lib/Semantics/expression.cpp
    A flang/test/Semantics/zero_len_char_array.f90

  Log Message:
  -----------
  [flang] Do not error on constant nonzero UB in substring of ZLA (#174511)

A substring reference where the lower bound is higher than the upper
bound is defined in 9.4.1 to be zero-length.

Thus, a reference to a substring of a CHARACTER*(0) string such as

    string(foo():2)

cannot be a compile-time error since we do not know the return value of
foo().

We also should not error if the lbound > ubound at compile time.



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