<p dir="ltr">It appears, from some quick googling, that createIndex enables multithreading in clang, which might explain this, depending on the threading libraries used.</p>
<p dir="ltr">Sam</p>
<div class="gmail_quote">On Oct 19, 2014 9:24 AM, "Matthew Flatt" <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It appears that calling clang_createIndex() sets the handler for<br>
SIGSEGV, which interferes with Racket's own SIGSEGV handler to<br>
implement the GC's write barrier.<br>
<br>
The program below illustrates. It sets the handler before and after a<br>
call to clang_createIndex() and shows that the handler has been changed<br>
after the call. If you comment out the clang_createIndex() call, then<br>
the handler is unchanged.<br>
<br>
I have no idea why clang_createIndex() would set the SIGSEGV handler or<br>
whether that can be disabled.<br>
<br>
----------------------------------------<br>
<br>
#include <stdio.h><br>
#include <string.h><br>
#include <signal.h><br>
#include <sys/types.h><br>
#include <unistd.h><br>
<br>
typedef void *CXIndex;<br>
extern CXIndex clang_createIndex(int, int);<br>
<br>
void fault_handler()<br>
{<br>
  printf("fault\n");<br>
}<br>
<br>
void check()<br>
{<br>
  struct sigaction act, oact;<br>
  memset(&act, 0, sizeof(act));<br>
  act.sa_sigaction = fault_handler;<br>
  sigemptyset(&act.sa_mask);<br>
  sigaction(SIGSEGV, &act, &oact);<br>
<br>
  printf("%p %d\n", oact.sa_sigaction, oact.sa_sigaction == fault_handler);<br>
}<br>
<br>
int main() {<br>
  void *dl;<br>
<br>
  check();<br>
<br>
  clang_createIndex(0, 0);<br>
<br>
  check();<br>
<br>
  return 0;<br>
}<br>
<br>
____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div>