Message ID | 20150121213347.GU1746@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On 01/21/2015 04:33 PM, Jakub Jelinek wrote: > +This option enables instrumentation of C++ member function calls, member > +accesses and some downcasts and upcasts, to verify the referenced object Instead of "downcasts and upcasts" I'd write "conversions between pointers to base and derived classes"; Bjarne specifically avoided "up" and "down" because they are unclear. Jason
On 01/21/2015 04:33 PM, Jakub Jelinek wrote: > Slightly off-topic, what do you think about replacing *this ={v} {CLOBBER}; > stmts in dtors of objects with virtual methods with storing of > NULL or some other value into the vtable pointer field, so that we would > (sometimes) catch member accesses and method calls after destruction? The clobber statement clobbers the entire object, not just the vptr, but setting the vptr to null when -fsanitize=vptr makes sense to me. Jason
--- gcc/doc/invoke.texi.jj 2015-01-20 11:51:41.000000000 +0100 +++ gcc/doc/invoke.texi 2015-01-21 12:49:14.679867871 +0100 @@ -5761,6 +5761,13 @@ This option enables instrumentation of l a value outside the range of values for the enum type is loaded, a run-time error is issued. +@item -fsanitize=vptr +@opindex fsanitize=vptr + +This option enables instrumentation of C++ member function calls, member +accesses and some downcasts and upcasts, to verify the referenced object +has the correct dynamic type. + @end table While @option{-ftrapv} causes traps for signed overflows to be emitted,