Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-04-27 Thread Jakub Jelinek via Gcc-patches
On Thu, Apr 27, 2023 at 12:10:40PM +, Richard Biener wrote: > The following generalizes the range-op for __builtin_expect > by using the fnspec machinery. > > We've defered this to stage1 - bootstrapped and tested on > x86_64-unknown-linux-gnu. > > OK? > > Thanks, > Richard. > > PR t

[PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-04-27 Thread Richard Biener via Gcc-patches
The following generalizes the range-op for __builtin_expect by using the fnspec machinery. We've defered this to stage1 - bootstrapped and tested on x86_64-unknown-linux-gnu. OK? Thanks, Richard. PR tree-optimization/109170 * gimple-range-op.cc (gimple_range_op_handler::maybe_b

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-21 Thread Jakub Jelinek via Gcc-patches
On Tue, Mar 21, 2023 at 08:21:18AM +, Richard Biener wrote: > On Mon, 20 Mar 2023, Jakub Jelinek wrote: > > > On Mon, Mar 20, 2023 at 12:12:14PM +, Richard Biener wrote: > > > PR tree-optimization/109170 > > > * gimple-range-op.cc (cfn_pass_through_arg1): New. > > > (gimple_range_op_

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-21 Thread Richard Biener via Gcc-patches
38e5a7942cfcb8c7444e6cca35d7523 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 17 Mar 2023 13:14:49 +0100 Subject: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect To: gcc-patches@gcc.gnu.org The following adds a missing range-op for __builtin_expect whi

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-20 Thread Jakub Jelinek via Gcc-patches
On Mon, Mar 20, 2023 at 12:12:14PM +, Richard Biener wrote: > PR tree-optimization/109170 > * gimple-range-op.cc (cfn_pass_through_arg1): New. > (gimple_range_op_handler::maybe_builtin_call): Handle > __builtin_expect and similar via cfn_pass_through_arg1 > and ins

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-20 Thread Richard Biener via Gcc-patches
HI). I also see that > we handle any PHI this way, not just PHIs defined in the same > BB as the condition which op we're ultimatively interested in. > > So my conclusion is that currently it's pure luck the testcase > "works", and thus adjusting it and ope

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-17 Thread Richard Biener via Gcc-patches
ichard. > > >From feb846cbff9774125d8401dfeacd8a4b9c2dccfa Mon Sep 17 00:00:00 2001 > > From: Richard Biener > > Date: Fri, 17 Mar 2023 13:14:49 +0100 > > Subject: [PATCH] tree-optimization/109170 - bogus use-after-free with > > __builtin_expect > > To: gcc-patc

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-17 Thread Jakub Jelinek via Gcc-patches
gt; Date: Fri, 17 Mar 2023 13:14:49 +0100 > Subject: [PATCH] tree-optimization/109170 - bogus use-after-free with > __builtin_expect > To: gcc-patches@gcc.gnu.org > > The following adds a missing range-op for __builtin_expect which > helps -Wuse-after-free to detect the case a real

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-17 Thread Andrew MacLeod via Gcc-patches
On 3/17/23 08:59, Jakub Jelinek wrote: On Fri, Mar 17, 2023 at 12:53:48PM +, Richard Biener wrote: On Fri, 17 Mar 2023, Jakub Jelinek wrote: On Fri, Mar 17, 2023 at 01:18:32PM +0100, Richard Biener wrote: The following adds a missing range-op for __builtin_expect which helps -Wuse-after

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-17 Thread Richard Biener via Gcc-patches
s [1, +INF] when we enter the loop). I have difficulties in restoring the testcase by massaging it, will try a bit more. I've implemented the fnspec variant as well now and then we also CSE the __builtin_expct call, see below for this patch variant. Richard. >From feb846cbff9774125d8401df

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-17 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 17, 2023 at 12:53:48PM +, Richard Biener wrote: > On Fri, 17 Mar 2023, Jakub Jelinek wrote: > > > On Fri, Mar 17, 2023 at 01:18:32PM +0100, Richard Biener wrote: > > > The following adds a missing range-op for __builtin_expect which > > > helps -Wuse-after-free to detect the case a

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-17 Thread Richard Biener via Gcc-patches
On Fri, 17 Mar 2023, Jakub Jelinek wrote: > On Fri, Mar 17, 2023 at 01:18:32PM +0100, Richard Biener wrote: > > The following adds a missing range-op for __builtin_expect which > > helps -Wuse-after-free to detect the case a realloc original > > pointer is used when the result was NULL. > > > > B

Re: [PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-17 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 17, 2023 at 01:18:32PM +0100, Richard Biener wrote: > The following adds a missing range-op for __builtin_expect which > helps -Wuse-after-free to detect the case a realloc original > pointer is used when the result was NULL. > > Bootstrap and regtest running on x86_64-unknown-linux-gn

[PATCH] tree-optimization/109170 - bogus use-after-free with __builtin_expect

2023-03-17 Thread Richard Biener via Gcc-patches
The following adds a missing range-op for __builtin_expect which helps -Wuse-after-free to detect the case a realloc original pointer is used when the result was NULL. Bootstrap and regtest running on x86_64-unknown-linux-gnu, OK? PR tree-optimization/109170 * gimple-range-op.cc (