[llvm] [BinaryFormat][Dwarf] Fix arity of DW_OP_over (PR #195216)

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 21:47:34 PDT 2026


https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/195216

DW_OP_over duplicates the entry second from the top of the stack ("equivalent to a DW_OP_pick operation, with index 1", DWARF v5 §2.5.1.3), so it requires at least two stack entries to evaluate.

>From e601fffac4efdc5657ee2124abfef863c95042d1 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Thu, 30 Apr 2026 21:46:58 -0700
Subject: [PATCH] [BinaryFormat][Dwarf] Fix arity of DW_OP_over
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

DW_OP_over duplicates the entry second from the top of the stack
("equivalent to a DW_OP_pick operation, with index 1", DWARF v5
§2.5.1.3), so it requires at least two stack entries to evaluate.
---
 llvm/include/llvm/BinaryFormat/Dwarf.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index 50b83884c851a..750587a45b74b 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -748,7 +748,7 @@ HANDLE_DW_OP(0x10, constu, 1, 0, 2, DWARF)
 HANDLE_DW_OP(0x11, consts, 1, 0, 2, DWARF)
 HANDLE_DW_OP(0x12, dup, 0, 1, 2, DWARF)
 HANDLE_DW_OP(0x13, drop, 0, 1, 2, DWARF)
-HANDLE_DW_OP(0x14, over, 0, 1, 2, DWARF)
+HANDLE_DW_OP(0x14, over, 0, 2, 2, DWARF)
 HANDLE_DW_OP(0x15, pick, 1, -1, 2, DWARF)
 HANDLE_DW_OP(0x16, swap, 0, 2, 2, DWARF)
 HANDLE_DW_OP(0x17, rot, 0, 3, 2, DWARF)



More information about the llvm-commits mailing list