<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace;font-size:large"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 24, 2017 at 1:24 AM, Larry Gritz via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
<br>
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 (<a href="https://github.com/ispc/ispc/blob/master/module.cpp#L2453" rel="noreferrer" target="_blank">https://github.com/ispc/ispc/<wbr>blob/master/module.cpp#L2453</a>).<br>
<br>
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:<br></blockquote></div><div style="font-family:courier new,monospace;font-size:large" class="gmail_default">​<br></div><div style="font-family:courier new,monospace;font-size:large" class="gmail_default">Try compiling with -fsanitize=address​</div><br clear="all"><div style="font-family:courier new,monospace;font-size:large" class="gmail_default">​Csaba​</div><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++<br>The Tao of math: The numbers you can count are not the real numbers.<br>Life is complex, with real and imaginary parts.<br>"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds<br>"People disagree with me. I just ignore them." -- Linus Torvalds<br><br></div>
</div></div>