Timm =?utf-8?q?Bäder?= <tbae...@redhat.com>,
Timm =?utf-8?q?Bäder?= <tbae...@redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/144...@github.com>


tbaederr wrote:

Can you try applying

```diff
diff --git i/clang/lib/AST/ByteCode/IntegralAP.h 
w/clang/lib/AST/ByteCode/IntegralAP.h
index 0280ea072ca9..4c1fb61e3e15 100644
--- i/clang/lib/AST/ByteCode/IntegralAP.h
+++ w/clang/lib/AST/ByteCode/IntegralAP.h
@@ -92,7 +92,10 @@ public:

   // Constructors.
   IntegralAP() = default;
-  IntegralAP(unsigned BitWidth) : BitWidth(BitWidth) {}
+  IntegralAP(unsigned BitWidth) : Val(0), BitWidth(BitWidth) {
+    assert(singleWord());
+    Val = 0;
+  }
   IntegralAP(uint64_t *Memory, unsigned BitWidth)
       : Memory(Memory), BitWidth(BitWidth) {}
   IntegralAP(const APInt &V) : BitWidth(V.getBitWidth()) {
```
(or the equivalent) and re-checking?

In the single-word case, we're not explicitly setting `Val` to `0` and since 
the `Memory` Pointer only partially overlaps with it, the resulting value is 
garbage.

(I with ubsan would catch reads from inactive union members but alas)

https://github.com/llvm/llvm-project/pull/144246
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to