c++: vptr ubsan and derived class [PR95311].
authorJason Merrill <jason@redhat.com>
Fri, 29 May 2020 15:59:33 +0000 (11:59 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 29 May 2020 16:21:21 +0000 (12:21 -0400)
commit8e915901deb3518d4bef73ea52eab2ece7a2bbf6
tree2ef890b17ce82be48d3d6ae010a321f0ca2799c5
parent83c34c4452b2d5fea4536c865e34b3c63f9acff6
c++: vptr ubsan and derived class [PR95311].

We weren't able to find OBJ_TYPE_REF_OBJECT walking through
OBJ_TYPE_REF_EXPR because we had folded away the ADDR_EXPR.

gcc/cp/ChangeLog:

PR c++/95311
PR c++/95221
* class.c (build_vfn_ref): Don't fold the INDIRECT_REF.

gcc/testsuite/ChangeLog:

PR c++/95311
* g++.dg/ubsan/vptr-16.C: New test.
gcc/cp/class.c
gcc/testsuite/g++.dg/ubsan/vptr-16.C [new file with mode: 0644]