================
@@ -12504,6 +12514,14 @@ void Sema::CheckImplicitConversion(Expr *E, QualType
T, SourceLocation CC,
IntRange TargetRange = IntRange::forTargetOfCanonicalType(Context, Target);
if (LikelySourceRange->Width > TargetRange.Width) {
+ // Check if target is a wrapping OBT - if so, don't warn about constant
+ // conversion because wrapping behavior is defined for truncation
----------------
kees wrote:
My perspective is that we want distinct behaviors between `__wrap` and
`__nowrap` so we get unambiguous results. In this case, you want a warning for
`__nowrap` and we do NOT want a warning for `__wrap`. The wrapping type is what
controls this, so I think it's correct to eat the truncation without a warning
here. I've seen this kind of thing done intentionally in Linux for a variety of
reasons.
https://github.com/llvm/llvm-project/pull/148914
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits