[clang] [Clang] [CodeGen] Fix codegen bug in constant initialisation in C23 mode (PR #84981)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 05:12:11 PDT 2024


================
@@ -216,3 +216,6 @@ int PR4517_x2 = PR4517_arrc[PR4517_idx];
 // CHECK: @PR4517_x = global i32 42, align 4
 // CHECK: @PR4517_idx = constant i32 1, align 4
 // CHECK: @PR4517_x2 = global i32 42, align 4
+
+// CHECK: @GH84784_inf = constant i8 1
+_Bool const GH84784_inf = (1.0/0.0);
----------------
AaronBallman wrote:

It'd also be good to add a test in Sema along the lines of:
```
_Bool const inf1 =  (1.0/0.0 == __builtin_inf()); // ok
constexpr _Bool inf2 =  (1.0/0.0 == __builtin_inf()); // expected-error
```

https://github.com/llvm/llvm-project/pull/84981


More information about the cfe-commits mailing list