[all-commits] [llvm/llvm-project] d889a7: [flang] Avoid UB in CharBlock Compare to C string ...

David Spickett via All-commits all-commits at lists.llvm.org
Tue Jul 8 00:52:57 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d889a7485f77c214ee57d0a74bf164237fdfa423
      https://github.com/llvm/llvm-project/commit/d889a7485f77c214ee57d0a74bf164237fdfa423
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2025-07-08 (Tue, 08 Jul 2025)

  Changed paths:
    M flang/include/flang/Parser/char-block.h

  Log Message:
  -----------
  [flang] Avoid UB in CharBlock Compare to C string (#147329)

The behaviour of strncmp is undefined if either string pointer is null
(https://en.cppreference.com/w/cpp/string/byte/strncmp.html).

I've copied the logic over from Compare to another CharBlock, which had
code to avoid UB in memcmp.

The test Preprocessing/kind-suffix.F90 was failing with UBSAN enabled,
and now passes.



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