efriedma-quic wrote: > > If you declare a variable as both wrapping and non-wrapping, is it wrapping? > > I am not sure how to do this. I am sure that with the magic of C anything is > possible but I can't conceive a way to have a variable both have the > attribute and not have the attribute (to be clear, there doesn't exist a > `__attribute__((no-wraps))` currently)
Say you declare a global variable like the following: ``` typedef int wrapint __attribute((wraps)); extern wrapint x; int x = 0; ``` Is "x" wrapping? > > If you mark a `short` wrapping, is the type after promotion wrapping? > > This concerns the `-fsanitize=implicit-signed-integer-truncation` sanitizer > which the wraps attribute disables. So the type boundaries pre- and > post-promotion are not enforced by this sanitizer for wrapping types. There are cases that don't involve truncation: ``` typedef short wrapshort __attribute((wraps)); short x = 0x7FFF; int y = x*x*x*x; ``` https://github.com/llvm/llvm-project/pull/86618 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits