[clang] [Clang] Add wraps attribute (for granular integer overflow handling) (PR #86618)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 22 14:47:18 PDT 2024
================
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -triple x86_64-pc-linux-gnu
+// expected-no-diagnostics
+typedef int __attribute__((wraps)) wrapping_int;
+
+void foo(void) {
+ const wrapping_int A = 1;
+ int D = 2147483647 + A;
----------------
bwendling wrote:
How about instead:
```c
int foo(void) {
const wrapping_int A = 1;
return 2147483647 + A;
}
```
https://github.com/llvm/llvm-project/pull/86618
More information about the cfe-commits
mailing list