[PATCH] D141192: [Clang] Fix warnings on bad shifts.
Dmitriy Chestnykh via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 8 05:39:12 PST 2023
chestnykh added a comment.
In D141192#4033962 <https://reviews.llvm.org/D141192#4033962>, @tbaeder wrote:
> In D141192#4033591 <https://reviews.llvm.org/D141192#4033591>, @shafik wrote:
>
>> So it looks like in `handleIntIntBinOp` we do hit this code:
>>
>> unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1);
>> if (SA != RHS) {
>> Info.CCEDiag(E, diag::note_constexpr_large_shift)
>> << RHS << E->getType() << LHS.getBitWidth();
>>
>> So maybe we should figure out why we decide not to emit this diagnostic and fix it there.
>
> We return `true` anyway and so the diagnostics are not printed. This is reached from a call to `VerifyIntegerConstantExpression()` IIRC.
Yes, but it seems there is no proper way to handle, for example, C code compiling in this place, so i left `DiagnoseBadShiftValues` changes.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141192/new/
https://reviews.llvm.org/D141192
More information about the cfe-commits
mailing list