[C++ PATCH] Fix sanitization ICE (PR c++/80973)

Jason Merrill jason@redhat.com
Fri Jun 9 19:30:00 GMT 2017


On Thu, Jun 8, 2017 at 12:30 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> cp_genericize_r now instruments INTEGER_CSTs that have REFERENCE_TYPE,
> so that we can diagnose binding references to NULL in some cases,
> see PR79572.  As the following testcase shows, there is one exception
> when we do not want to do that - in MEM_EXPR, the second operand
> is an INTEGER_CST whose value is an offset, but type is something
> unrelated - what should be used for aliasing purposes.  So, that
> is something we do not want to diagnose, and it is also invalid IL,
> as the second argument has to be an INTEGER_CST, not some expression
> with side-effects.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk/7.x?
>
>         PR c++/80973
>         * cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
>         argument even if it has REFERENCE_TYPE.

I wonder if we want to handle this in walk_tree_1, so all tree walks
by default avoid the second operand.

Jason



More information about the Gcc-patches mailing list