aaron.ballman added inline comments.
================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:2424
+ type->isPromotableIntegerType()) {
+ // While `x += 1` (for `x` with width less than int) is modelled as
+ // promotion+arithmetics+demotion, and we can catch lossy demotion with
----------------
modelled -> modeled
================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:2428
+ // promotion rules, so we omit promotion+demotion, which means that we
can
+ // not catch lossy "demotion". Since we still want to catch those cases,
+ // if the sanitizer is enabled, let's perform the promotion, perform
----------------
lebedev.ri wrote:
> erichkeane wrote:
> > comma at the end here isn't required. The one after 'enabled' needs to be
> > a semicolon I think?
> > comma at the end here isn't required.
> Right.
>
> > The one after 'enabled' needs to be a semicolon I think?
> It doesn't look like that to me?
>
>
I'd reword it to make the problem go away. :-D
```
Because we still want to catch these cases when the sanitizer is enabled, we
perform the promotion, then perform the increment/decrement in the wider type,
and finally perform the demotion. This will catch lossy demotions.
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70539/new/
https://reviews.llvm.org/D70539
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits