[PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-02-16 Thread Alexandre Oliva via Gcc-patches
check_dangling_stores has some weirdnesses that causes its behavior to change when the target ABI requires C++ ctors to return this: while scanning stmts backwards in e.g. the AS ctor on a target that returns this in ctors, the scan first encounters a copy of this to the SSA name used to hold the

Re: [PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-02-16 Thread Richard Biener via Gcc-patches
On Fri, Feb 17, 2023 at 8:09 AM Alexandre Oliva via Gcc-patches wrote: > > > check_dangling_stores has some weirdnesses that causes its behavior to > change when the target ABI requires C++ ctors to return this: while > scanning stmts backwards in e.g. the AS ctor on a target that returns > this i

Re: [PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-02-17 Thread Alexandre Oliva via Gcc-patches
Hi, richi, On Feb 17, 2023, Richard Biener wrote: > It seems the case should run into Yeah, but when the stmt is _7 = this_2(D), lhs is _7, whereas lhs_ref.ref is this_2(D), a parm decl's default def, so def_stmt is a gimple_nop, and this is not a decl_by_reference, so we don't skip stores.add,

Re: [PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-02-17 Thread Alexandre Oliva via Gcc-patches
On Feb 17, 2023, Alexandre Oliva wrote: > Now, really, I did not get as far as trying to make sense of the > algorithm in there (get_ref definitely doesn't do what its name suggests > to me), I just saw a bunch of weirdnesses in blackbox testing and > failing variations, that seemed to suggest so

Re: [PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-03-03 Thread Alexandre Oliva via Gcc-patches
On Feb 17, 2023, Richard Biener wrote: >> * gimple-ssa-warn-access.cc >> (pass_waccess::check_dangling_stores): Skip non-stores. >> >> for gcc/testsuite/ChangeLog >> >> * g++.dg/warn/Wdangling-pointer.C (warn_init_ref_member): Add >> two new variants, one fixed, one xfailed. >> * c-c++-common/

Re: [PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-03-03 Thread Richard Biener via Gcc-patches
On Fri, Mar 3, 2023 at 9:30 AM Alexandre Oliva wrote: > > On Feb 17, 2023, Richard Biener wrote: > > >> * gimple-ssa-warn-access.cc > >> (pass_waccess::check_dangling_stores): Skip non-stores. > >> > >> for gcc/testsuite/ChangeLog > >> > >> * g++.dg/warn/Wdangling-pointer.C (warn_init_ref_member

Re: [PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-03-08 Thread Martin Liška
On 3/3/23 12:12, Richard Biener via Gcc-patches wrote: > On Fri, Mar 3, 2023 at 9:30 AM Alexandre Oliva wrote: >> >> On Feb 17, 2023, Richard Biener wrote: >> * gimple-ssa-warn-access.cc (pass_waccess::check_dangling_stores): Skip non-stores. for gcc/testsuite/ChangeLog

Re: [PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-03-08 Thread Richard Biener via Gcc-patches
On Wed, Mar 8, 2023 at 2:04 PM Martin Liška wrote: > > On 3/3/23 12:12, Richard Biener via Gcc-patches wrote: > > On Fri, Mar 3, 2023 at 9:30 AM Alexandre Oliva wrote: > >> > >> On Feb 17, 2023, Richard Biener wrote: > >> > * gimple-ssa-warn-access.cc > (pass_waccess::check_dangling_st

Re: [PATCH] -Wdangling-pointer: don't mark SSA lhs sets as stores

2023-03-09 Thread Alexandre Oliva via Gcc-patches
On Mar 8, 2023, Richard Biener wrote: > On Wed, Mar 8, 2023 at 2:04 PM Martin Liška wrote: >> Is the emitted warning correct? > For the reduced testcase yes, if !aio_bh_poll_s (or !aio_bh_poll_bh) > the stored pointer remains local. *nod*, before the recent patch, it would have failed to iss