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

2024-03-13 Thread via cfe-commits
https://github.com/Sirraide closed https://github.com/llvm/llvm-project/pull/84981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-13 Thread via cfe-commits
Sirraide wrote: CI is just going to fail again because of the aforementioned problem, so I’m just going to merge this now and hope I won’t have to revert it later. https://github.com/llvm/llvm-project/pull/84981 ___ cfe-commits mailing list

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

2024-03-13 Thread via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c23 %s + +// Division by 0 here is an error iff the variable is 'constexpr'. +const _Bool inf1 = (1.0/0.0 == __builtin_inf()); +constexpr _Bool inf2 = (1.0/0.0 == __builtin_inf()); // expected-error {{must be

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

2024-03-13 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/84981 >From b60ff0c29f367306beb5ea0965dfaf5b7f361654 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Tue, 12 Mar 2024 13:53:34 +0100 Subject: [PATCH 1/6] [Clang] [CodeGen] Fix codegen bug in constant initialisation in

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

2024-03-13 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c23 %s + +// Division by 0 here is an error iff the variable is 'constexpr'. +const _Bool inf1 = (1.0/0.0 == __builtin_inf()); +constexpr _Bool inf2 = (1.0/0.0 == __builtin_inf()); // expected-error {{must be

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

2024-03-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/84981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/84981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-13 Thread via cfe-commits
Sirraide wrote: I’ve added the test. The CI failure is the same thing from a few days ago I think; must be because I created this branch before updating the main branch. https://github.com/llvm/llvm-project/pull/84981 ___ cfe-commits mailing list

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

2024-03-13 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/84981 >From b60ff0c29f367306beb5ea0965dfaf5b7f361654 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Tue, 12 Mar 2024 13:53:34 +0100 Subject: [PATCH 1/5] [Clang] [CodeGen] Fix codegen bug in constant initialisation in

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

2024-03-13 Thread via cfe-commits
@@ -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 =

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

2024-03-13 Thread Aaron Ballman via cfe-commits
@@ -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 =

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

2024-03-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Thank you for the fix! This is looking pretty good to me. https://github.com/llvm/llvm-project/pull/84981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-03-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/84981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-12 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/84981 >From b60ff0c29f367306beb5ea0965dfaf5b7f361654 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Tue, 12 Mar 2024 13:53:34 +0100 Subject: [PATCH 1/4] [Clang] [CodeGen] Fix codegen bug in constant initialisation in

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

2024-03-12 Thread via cfe-commits
@@ -259,6 +259,10 @@ Bug Fixes in This Version operator. Fixes (#GH83267). +- Clang no longer fails to codegen static ``const`` variables whose initialiser performs + a floating-point division by 0 in C23. + Fixes (#GH84784). Sirraide wrote: Oh, I

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

2024-03-12 Thread Eli Friedman via cfe-commits
@@ -259,6 +259,10 @@ Bug Fixes in This Version operator. Fixes (#GH83267). +- Clang no longer fails to codegen static ``const`` variables whose initialiser performs + a floating-point division by 0 in C23. + Fixes (#GH84784). efriedma-quic wrote: We

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

2024-03-12 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/84981 >From b60ff0c29f367306beb5ea0965dfaf5b7f361654 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Tue, 12 Mar 2024 13:53:34 +0100 Subject: [PATCH 1/3] [Clang] [CodeGen] Fix codegen bug in constant initialisation in

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

2024-03-12 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/84981 >From b60ff0c29f367306beb5ea0965dfaf5b7f361654 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Tue, 12 Mar 2024 13:53:34 +0100 Subject: [PATCH 1/2] [Clang] [CodeGen] Fix codegen bug in constant initialisation in

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

2024-03-12 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: None (Sirraide) Changes Consider the following code: ```c bool const inf = (1.0/0.0); ``` When trying to emit the initialiser of this variable in C23, we end up hitting a code path in codegen in `VarDecl::evaluateValueImpl()`

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

2024-03-12 Thread via cfe-commits
https://github.com/Sirraide created https://github.com/llvm/llvm-project/pull/84981 Consider the following code: ```c bool const inf = (1.0/0.0); ``` When trying to emit the initialiser of this variable in C23, we end up hitting a code path in codegen in `VarDecl::evaluateValueImpl()` where