================
@@ -5969,6 +5640,16 @@ class CaptureVars : public TreeTransform<CaptureVars> {
 };
 } // namespace
 
+/// Like ASTContext::getIntTypeForBitwidth, but falls back to a _BitInt type
+/// when no standard integer type has the requested width.
+static QualType getIntTypeForBitwidthOrBitInt(ASTContext &C, unsigned Bits,
+                                              bool Signed) {
+  QualType Ty = C.getIntTypeForBitwidth(Bits, Signed);
+  if (Ty.isNull())
+    Ty = C.getBitIntType(/*IsUnsigned=*/!Signed, Bits);
----------------
akash-manna-sky wrote:

That would narrow the bound, not the count. Only `Upper` is cast here, and 
`(unsigned long)b - a` still has type `_BitInt(931)`, so a truncated `Upper` 
gives a wrong count even when the count fits in 64 bits (GCC's libgomp 
`bitint-1.c` `baz`: 2^930 bounds, 77 iterations, comes out as a large negative 
number). The count itself is already narrowed to 64 bits with 
`warn_omp_loop_64_bit_var` in `buildNumIterations`, same as `__int128`.


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

Reply via email to