[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-28 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `openmp-offload-libc-amdgpu-runtime` running on `omp-vega20-1` while building `clang` at step 7 "Add check check-offload". Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/12566 Here is the r

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-28 Thread Nikita Popov via cfe-commits
https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/122486 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

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

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-27 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/122486 >From 925f74cad21eb6c46514d1ae543ac202073baf27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Jan 2025 17:01:07 +0100 Subject: [PATCH 1/5] [Clang] Add -fwrapv-pointer flag GCC supports three flags rela

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-25 Thread Fangrui Song via cfe-commits
@@ -1,11 +1,20 @@ // RUN: %clang -### -S -fwrapv -fno-wrapv -fwrapv %s 2>&1 | FileCheck -check-prefix=CHECK1 %s // CHECK1: -fwrapv // +// RUN: %clang -### -S -fwrapv-pointer -fno-wrapv-pointer -fwrapv-pointer %s 2>&1 | FileCheck -check-prefix=CHECK1-POINTER %s +// CHECK1-POIN

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-25 Thread Fangrui Song via cfe-commits
@@ -1,11 +1,20 @@ // RUN: %clang -### -S -fwrapv -fno-wrapv -fwrapv %s 2>&1 | FileCheck -check-prefix=CHECK1 %s // CHECK1: -fwrapv // +// RUN: %clang -### -S -fwrapv-pointer -fno-wrapv-pointer -fwrapv-pointer %s 2>&1 | FileCheck -check-prefix=CHECK1-POINTER %s +// CHECK1-POIN

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-25 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/122486 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-25 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. Will be used by chromium and other users. There is some gap in sanitizer that is not so important. LGTM, but other reviewers need to stamp as well. https://github.com/llvm/llvm-project/pull/122486 __

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
@@ -4311,14 +4311,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // GEP indexes are signed, and scaling an index isn't permitted to // signed-overflow, so we use the same semantics for our explicit // multiply. We suppress this i

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
@@ -4311,14 +4311,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // GEP indexes are signed, and scaling an index isn't permitted to // signed-overflow, so we use the same semantics for our explicit // multiply. We suppress this i

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/122486 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: CC @llvm/clang-vendors : this changes the behavior of -fwrapv. Internally, I expect it's going to be a bit painful to communicate to all our internal teams that they need to change their -fwrapv usage to -fno-strict-overflow, but if we think it's imp

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Nikita Popov via cfe-commits
@@ -1,11 +1,24 @@ // RUN: %clang -### -S -fwrapv -fno-wrapv -fwrapv %s 2>&1 | FileCheck -check-prefix=CHECK1 %s // CHECK1: -fwrapv // +// RUN: %clang -### -S -fwrapv-pointer -fno-wrapv-pointer -fwrapv-pointer %s 2>&1 | FileCheck -check-prefix=CHECK1-POINTER %s +// CHECK1-POIN

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/122486 >From 925f74cad21eb6c46514d1ae543ac202073baf27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Jan 2025 17:01:07 +0100 Subject: [PATCH 1/3] [Clang] Add -fwrapv-pointer flag GCC supports three flags rela

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Fangrui Song via cfe-commits
@@ -1,11 +1,24 @@ // RUN: %clang -### -S -fwrapv -fno-wrapv -fwrapv %s 2>&1 | FileCheck -check-prefix=CHECK1 %s // CHECK1: -fwrapv // +// RUN: %clang -### -S -fwrapv-pointer -fno-wrapv-pointer -fwrapv-pointer %s 2>&1 | FileCheck -check-prefix=CHECK1-POINTER %s +// CHECK1-POIN

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Nikita Popov via cfe-commits
@@ -57,15 +57,6 @@ void test1(void) { // TRAPV_HANDLER: foo( --a; - // -fwrapv should turn off inbounds for GEP's, PR9256 - extern int* P; - ++P; - // DEFAULT: getelementptr inbounds nuw i32, ptr - // WRAPV: getelementptr i32, ptr - // TRAPV: getelementptr inbounds

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/122486 >From 925f74cad21eb6c46514d1ae543ac202073baf27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Jan 2025 17:01:07 +0100 Subject: [PATCH 1/2] [Clang] Add -fwrapv-pointer flag GCC supports three flags rela

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/122486 >From 925f74cad21eb6c46514d1ae543ac202073baf27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Jan 2025 17:01:07 +0100 Subject: [PATCH 1/2] [Clang] Add -fwrapv-pointer flag GCC supports three flags rela

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Aaron Ballman via cfe-commits
@@ -79,7 +79,15 @@ code bases. Undefined behavior due to pointer addition overflow can be reliably detected using ``-fsanitize=pointer-overflow``. It is also possible to use ``-fno-strict-overflow`` to opt-in to a language dialect where signed integer - and pointer overf

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Aaron Ballman via cfe-commits
@@ -57,15 +57,6 @@ void test1(void) { // TRAPV_HANDLER: foo( --a; - // -fwrapv should turn off inbounds for GEP's, PR9256 - extern int* P; - ++P; - // DEFAULT: getelementptr inbounds nuw i32, ptr - // WRAPV: getelementptr i32, ptr - // TRAPV: getelementptr inbounds

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/122486 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: The changes look correct to me, but I'd love to hear from the codegen and sanitizer experts as to whether they agree with the changes and the timeline to land it for 20. https://github.com/llvm/llvm-project/pull/122486

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: I am a bit concerned about the behavioral change, but given the more aggressive optimizations in LLVM 20, I think it makes sense to get this into Clang 20 to see what the fallout is during early RCs. If there's negative impact, we can consider cherry-picking a revert from t

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Nikita Popov via cfe-commits
nikic wrote: If we want to make this change, I think doing it for Clang 20 would be ideal, because it is related to the pointer overflow optimization changes in that release. https://github.com/llvm/llvm-project/pull/122486 ___ cfe-commits mailing li

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-23 Thread Shafik Yaghmour via cfe-commits
https://github.com/shafik commented: I feel like matching gcc's behavior makes sense for users but I am not sure about the timing for clang-20. This seems like the change in behavior could be impactful. https://github.com/llvm/llvm-project/pull/122486 __

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-23 Thread Carlo Cabrera via cfe-commits
carlocab wrote: > Matching gcc's behavior for -f flags both compilers have also makes sense, > IMHO. Agree with this, FWIW. https://github.com/llvm/llvm-project/pull/122486 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-23 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/122486 >From 925f74cad21eb6c46514d1ae543ac202073baf27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Jan 2025 17:01:07 +0100 Subject: [PATCH] [Clang] Add -fwrapv-pointer flag GCC supports three flags related

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-22 Thread Nico Weber via cfe-commits
nico wrote: We (chromium) turned on fwrapv due to the pointer changes, and it had a bit of a perf hit. We'd probably switch to this, hoping it'd address the perf issues at least some. Matching gcc's behavior for -f flags both compilers have also makes sense, IMHO. https://github.com/llvm/llvm

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-13 Thread Nikita Popov via cfe-commits
nikic wrote: > I'm tempted to say we should just treat > -fwrapv/-fwrapv-pointer/-fno-strict-overflow as aliases for each other. I > don't think anyone using -fwrapv is going to be happy that we're turning on > overflow optimizations. Yeah, I'm not entirely sure this change is worthwhile eith

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm tempted to say we should just treat -fwrapv/-fwrapv-pointer/-fno-strict-overflow as aliases for each other. I don't think anyone using -fwrapv is going to be happy that we're turning on overflow optimizations. https://github.com/llvm/llvm-project/pull/122486

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/122486 >From b32e3e1eee4b359ae2f0a1563420104de8d52277 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Jan 2025 17:01:07 +0100 Subject: [PATCH] [Clang] Add -fwrapv-pointer flag GCC supports three flags related

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/122486 >From 1f3737d2eeb7681cb57a66f7bd6c4614cd038aac Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Jan 2025 17:01:07 +0100 Subject: [PATCH] [Clang] Add -fwrapv-pointer flag GCC supports three flags related

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/122486 >From b8c7a369fffecc9d1811d286fb1536346045fb74 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Jan 2025 17:01:07 +0100 Subject: [PATCH] [Clang] Add -fwrapv-pointer flag GCC supports three flags related

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff c39500f88c93f668c68bdafe56bd8d16e8abbec1 32fe619505787c434f97b01da0458ba7861f9550 --e

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Nikita Popov (nikic) Changes GCC supports three flags related to overflow behavior: * `-fwrapv`: Makes signed integer overflow well-defined. * `-fwrapv-pointer`: Makes pointer overflow well-defined. * `-fno-strict-overflow`: Impli

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/122486 GCC supports three flags related to overflow behavior: * `-fwrapv`: Makes signed integer overflow well-defined. * `-fwrapv-pointer`: Makes pointer overflow well-defined. * `-fno-strict-overflow`: Implies `-fwrap