[LLVMbugs] [Bug 13761] New: Passing a temp struct using a reference behaves badly with -faddress-sanitizer [Windows]
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Sep 4 06:23:22 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13761
Bug #: 13761
Summary: Passing a temp struct using a reference behaves badly
with -faddress-sanitizer [Windows]
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: timurrrr at google.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
As of r163111,
----------------------------
$ cat header.h
struct S {
explicit S(const char *p);
const char *a, *b;
};
----------------------------
$ cat with_cl.cpp
#include "header.h"
extern "C" int printf(const char *fmt, ...);
void foo(struct S &s) {
printf("a = %p\nb = %p\n", s.a, s.b);
}
int main() {
foo(S((char*)0x42));
}
----------------------------
$ cat with_clang.cpp
#include "header.h"
S::S(const char *p) : a(p), b(p) {}
----------------------------
$ cl -Zi -nologo -c with_cl.cpp with_clang.cpp && link -nologo with_cl.obj
with_clang.obj && ./with_cl.exe
a = 00000042
b = 00000042 # OK
$ clang -Xclang -cxx-abi -Xclang microsoft -c with_clang.cpp && cl -nologo -c
with_cl.cpp && link -nologo with_cl.obj with_clang.o
C:/src/asan/rtl/lib/asan/asan_rtl.lib && ./with_cl.exe
with_cl.cpp
a = 00000042
b = 00000042 # OK
$ clang -faddress-sanitizer -Xclang -cxx-abi -Xclang microsoft -c
with_clang.cpp && cl -nologo -c with_cl.cpp && link -nologo with_cl.obj
with_clang.o asan_rtl.lib && ./with_cl.exe
with_cl.cpp
a = 00000042
b = 0018FF88 # OOPS!
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list