================
@@ -3799,10 +3799,29 @@ bool Compiler<Emitter>::VisitOffsetOfExpr(const 
OffsetOfExpr *E) {
         continue;
       }
 
+      if (IndexT == PT_IntAP || IndexT == PT_IntAPS) {
+        // AP types (e.g. __uint128_t, __int128) cannot be safely cast to
----------------
marlus wrote:

Done. Added CastNoOverflow in Opcodes.td (with a new APOnlyTypeClass covering 
IntAP/IntAPS), implemented it in Interp.h (pops AP value, rejects if 
isNegative() || getActiveBits() > 63, pushes as Sint64), and updated 
Compiler.cpp to emit visit + CastNoOverflow for AP types. Small values like 
(__uint128_t)1 now work correctly, and values that don't fit in int64_t fail 
constant evaluation.

https://github.com/llvm/llvm-project/pull/204139
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to