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

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
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_handler::maybe_builtin_call): Handle > > __builtin_expect and simi

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
On Mon, 20 Mar 2023, Richard Biener wrote: > On Fri, 17 Mar 2023, Jakub Jelinek wrote: > > > On Fri, Mar 17, 2023 at 02:18:52PM +, Richard Biener wrote: > > > > And as you show on the testcases, it probably isn't a good idea for > > > > BUILT_IN_EXPECT* either. > > > > > > > > So, perhaps us

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:55:51PM +, Richard Biener wrote: > > > Anyway, I think it is fine to implement __builtin_expect this way > > > for now, ERF_RETURNS_ARG will be more important for pointers, especially > > > if > > > we propagate something

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:55:51PM +, Richard Biener wrote: > > Anyway, I think it is fine to implement __builtin_expect this way > > for now, ERF_RETURNS_ARG will be more important for pointers, especially if > > we propagate something more than just maybe be/can't be/must be null. > > Don't y

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
On Fri, 17 Mar 2023, 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 wh

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