[all-commits] [llvm/llvm-project] 2a9a78: [IR] Fix null pointer dereference in Constant::toC...

Jim Lin via All-commits all-commits at lists.llvm.org
Wed May 6 23:14:56 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2a9a78d0eec8a3a4a75c565f552443114d476217
      https://github.com/llvm/llvm-project/commit/2a9a78d0eec8a3a4a75c565f552443114d476217
  Author: Jim Lin <jim at andestech.com>
  Date:   2026-05-07 (Thu, 07 May 2026)

  Changed paths:
    M llvm/lib/IR/Constants.cpp
    M llvm/unittests/IR/ConstantsTest.cpp

  Log Message:
  -----------
  [IR] Fix null pointer dereference in Constant::toConstantRange() for ConstantByte (#193874)

In the ConstantVector path of toConstantRange(), the code checks that
each element is either a ConstantInt or ConstantByte but unconditionally
dereferences the ConstantInt pointer to get the value. When the element
is a ConstantByte, the ConstantInt pointer is null, causing a crash.

This was introduced in 57568c288dbe when ConstantByte support was added
to toConstantRange() but the fallback to CB->getValue() was missed.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply at anthropic.com>



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