https://github.com/Teemperor created 
https://github.com/llvm/llvm-project/pull/195926

`TestScriptedFrameProvider.py` currently fails with the following UBSan error:

```
runtime error: load of value 39, which is not a valid value for type 
'lldb::ValueType'
```

The reason for this is that we don't specify an underlying type, so the 
compiler infers the range based on the bits needed to represent all enumerators.
But when we OR in ValueTypeSyntheticMask, the resulting value is larger than 
the inferred bit-range from the enumerators.

This patch just assigns an underlying type that is large enough to store all 
enum values + the ValueTypeSyntheticMask bit.

>From f50f4c4c6c7d25690bb92dc60d1c8d2e38560710 Mon Sep 17 00:00:00 2001
From: Raphael Isemann <[email protected]>
Date: Tue, 5 May 2026 20:50:38 +0100
Subject: [PATCH] [lldb] Fix invalid-enum-load errors for ValueType

`TestScriptedFrameProvider.py` currently fails with the following
UBSan error:

```
runtime error: load of value 39, which is not a valid value for type 
'lldb::ValueType'
```

The reason for this is that we don't specify an underlying type,
so the compiler infers the range based on the bits needed to
represent all enumerators.
But when we OR in ValueTypeSyntheticMask, the resulting
value is larger than the inferred bit-range from the enumerators.

This patch just assigns an underlying type that is large enough to
store all enum values + the ValueTypeSyntheticMask bit.
---
 lldb/include/lldb/lldb-enumerations.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/include/lldb/lldb-enumerations.h 
b/lldb/include/lldb/lldb-enumerations.h
index 9b21af2e9882e..c5b314a6cba5f 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -330,7 +330,7 @@ enum ErrorType {
   eErrorTypeWin32       ///< Standard Win32 error codes.
 };
 
-enum ValueType {
+enum ValueType : uint8_t {
   eValueTypeInvalid = 0,
   eValueTypeVariableGlobal = 1,   ///< globals variable
   eValueTypeVariableStatic = 2,   ///< static variable

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to