On Fri, Jan 9, 2015 at 1:44 PM, Bernd Edlinger <bernd.edlin...@hotmail.de> wrote: > > > On Fri, 9 Jan 2015 13:30:45, Jakub Jelinke wrote: >> >> On Fri, Jan 09, 2015 at 01:12:09PM +0100, Bernd Edlinger wrote: >>>>> should be equivalent to >>>>> >>>>> if (DECL_P (base) && !may_be_aliased (base)) >>>>> return false; >>>>> >>>>> is that right? >>>> >>>> Yes, well, not exactly, but I wonder if its worth doing the extra check >>>> if you only check decl accesses anyway and not indirect accesses. >>>> >>> >>> >>> I think Jakub, you wrote that initially, any comments on that? >> >> I think it was still from Dmitry's code. If you can make it work by taking >> address of base and offsetting it, it works for me. Just note that I think >> base doesn't have to be always addressable, so you probably should punt if >> it is not rather than assert it is. If something is not addressable, then >> it can't be accessed by multiple threads. >> > > Thanks. > > FYI: the VIEW_CONVERT_EXPR did not fail in the > gcc_checking_assert (is_gimple_addressable (base)) > but much later, somewhere in tree-cfg.c it dropped out.
How did it fail there? It doesn't look like &VIEW_CONVERT_EXPR is forbidden. > Maybe that assert does not check exactly what is > needed for a valid argument of ADDR_EXPR ? Indeed, it's a gimplifier predicate not to be used elsewhere. tree-ssa-loop-ivopts.c:may_be_nonaddressable_p is more sophisticated. > I mean I can somehow fold an ADDR_EXPR of a bit field member, > This won't crash at all, but I can't fold ADDR_EXPR(VIEW_CONVERT_EXPR). well, that's probably because it will return (ptr *)&xxx, thus not a valid gimple result. You need to funnel that through force_gimple_operand. That said, please try removing all the code and using &base + offset + bitoffset / BITS_PER_UNIT as I said. Richard. > > Bernd. > >