[PATCH] No memcpy for copy ctor with -fsanitize-address-field-padding=1
Nico Weber
thakis at chromium.org
Thu Dec 11 01:26:08 PST 2014
Sorry about the slow review.
Rather than adding all these checks before calling EmitAggregateCopy(), is it maybe possible to do this check in EmitAggregateCopy() itself? Else there will always be cases that you miss. For example:
$ cat foo.cc
struct ClassWithTrivialCopy {
ClassWithTrivialCopy();
~ClassWithTrivialCopy();
void *a;
private:
void *c;
};
struct NontrivialCopy {
NontrivialCopy(const NontrivialCopy&);
};
struct pair {
NontrivialCopy nc;
ClassWithTrivialCopy second[4];
pair(const pair&) = default;
};
void MakeTrivialCopy( const pair &p) {
pair p2(p);
}
$ bin/clang -c foo.cc -std=c++11 -fsanitize=address -fsanitize-address-field-padding=1 -emit-llvm -S -o - | grep memcpy
%68 = call i8* @__asan_memcpy(i8* %66, i8* %67, i64 128)
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #4
declare i8* @__asan_memcpy(i8*, i8*, i64)
http://reviews.llvm.org/D6515
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list