[Interest] Using AddressSanitizer with Qt on Windows

Adam Light aclight at gmail.com
Tue Feb 22 01:43:28 CET 2022


Has anyone been able to successfully run/test a Qt based application built
with AddressSanitizer enabled on Windows? I have a 64-bit Qt 6.2.4 build
that I built from git using MS Visual Studio 2022 (updated in the last
couple of weeks). I've tried building our application, as well as a couple
Qt example applications (mainwindow and lineedit) using qmake with this in
the additional arguments setting for the qmake build step in Creator:
QMAKE_CFLAGS+=-fsanitize=address QMAKE_CXXFLAGS+=-fsanitize=address

If I try to run any of these three applications, execution breaks very
early on. For example, with mainwindow execution stops at
QArrayData::reallocateUnaligned. This is while executing
qInitResources_cursors further up in the call stack.

When I run the lineedit example the break is in the initialization of
harfbuzz.

I have tried debug and release builds, I tried building Qt with the same
CFLAGS and CXXFLAGS, and I've tried using cl-clang.exe instead of cl.exe as
the compiler. All combinations end up hitting a break in execution pretty
early, though not always in the same place.

Unlike when I've used asan on macOS, I'm not seeing the full sanitizer
output in Creator's application output window, so it's not clear to me
whether these are legitimate bugs or if something else is going on.

Thanks for any advice
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220221/45df4d15/attachment-0001.htm>


More information about the Interest mailing list