[cfe-dev] Using clang internals to preprocess a buffer, crashing with double free
Csaba Raduly via cfe-dev
cfe-dev at lists.llvm.org
Fri Feb 24 01:43:49 PST 2017
On Fri, Feb 24, 2017 at 1:24 AM, Larry Gritz via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> Hi, helpful people. I'm trying to use clang internals to run an in-memory
> buffer through the C preprocessor (string to string), and I'm having
> trouble. I wonder if one of you kind souls might be able to spot the
> problem.
>
> I cobbled this code together looking at clang's BufferSourceTest.cpp unit
> test (for the aspect of how to read from a buffer), and for how to invoke
> just the preprocessor, I looked at the source code for ISPC (
> https://github.com/ispc/ispc/blob/master/module.cpp#L2453).
>
> The C++11 code below, linked against clang/llvm 3.9, works just fine if I
> compile my code with clang (any of 3.5, 3.9, 4.0) or with g++ 4.8.5. But
> when I build my code with g++ 4.9, 5.4, or 6.2, it seems to compile fine
> but will crash at runtime during the exit of this function, with the
> following error:
>
Try compiling with -fsanitize=address
Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus
Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170224/7d647cf4/attachment.html>
More information about the cfe-dev
mailing list