This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug sanitizer/66514] UBSAN: Add -fsanitize=lifetime


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66514

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
There is some minimal support in -fsanitize=vptr, but that catches only
destructed objects with virtual methods (by disabling the clobbers and clearing
the vptr).
Other than that, this is something that is more in line with the address
sanitizer (which also has very limited support for file scope objects, but only
makes the objects unavailable during construction of each TU, so catches
constructor ordering issues within a single TU).  Other than that, the concept
of making a chunk of memory available at certain point and unavailable at
another point is something -fsanitize=address is able to do.  The question is
what can be done with operator new, e.g. if you have a char buffer in some
class and construct something else at that spot, then destructing it; reading
those bytes afterwards is supposedly UB, but storing there something say with
memcpy shouldn't be invalid.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]