<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>I have implemented a new Stmt in clang which given</div><div><br></div><div>__speculate {</div><div> // user code</div><div>}</div><div><br></div><div>generates LLVM IR equivalent to as if the following code was given:</div><div><br></div><div>jmp_buf __setjmp_buf;</div><div>int __setjmp_status = setjmp(__setjmp_buf);</div><div>unsigned int __spec_mode = __spec_begin(__setjmp_buf, __setjmp_status);</div><div>if (__spec_mode == SW) {</div><div>  // unmodified user code</div><div>} else </div><div> // unmodified user code</div><div>}</div><div><br></div><div>However, if UninitializedVariablesAnalysis is enabled, clang crashes at runOnBlock function (lib/Analysis/UninitializedValues.cpp). If I disable it via -Wno-uninitialized, the code generated runs flawlessly and works as expected. <br><br>By adding some "->dumps()" calls I was able to discover that the crash happens while analyzing:</div><div><br></div><div>unsigned int __spec_mode = __spec_begin(__setjmp_buf, __setjmp_status);<br></div><div><br></div><div>The UninitializedVariables Analysis generates the following classifications before crashing:</div><div><br></div><div><div><ul><li>DeclRefExpr 0x22a1940 'unsigned int (jmp_buf *, int)' Function 0x22a17d0 '<b>__spec_begin</b>' 'unsigned int (jmp_buf *, int)' <b>as "ClassifyRefs::Ignore"</b></li><li>DeclRefExpr 0x22a1680 'jmp_buf':'struct __jmp_buf_tag [1]' Var 0x22a1248 '<b>__setjmp_buf</b>' 'jmp_buf':'struct __jmp_buf_tag [1]' <b>as "ClassifyRefs::Ignore"</b></li><li>DeclRefExpr 0x22a16c8 'int' Var 0x22a12a8 '<b>__setjmp_ret</b>' 'int' <b>as "ClassifyRefs::Use"</b></li></ul></div></div><div>So it seems that the analysis successfully classifies the call and both of its arguments, but crashes while analyzing the <b>__spec_mode</b> variable.</div><div><br></div><div>Any guesses on what I am doing wrong?</div><div><br></div><div>-- <br><div dir="ltr" class="m_-4755687505317341439gmail-m_-8930374412273695135gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>João Paulo L. de Carvalho<br>Computer Science |  IC-UNICAMP | Campinas , SP - Brazil</div><div><a href="mailto:jaopaulolc@gmail.com" target="_blank">jaopaulolc@gmail.com</a></div><div><a href="mailto:joao.carvalho@ic.unicamp.br" target="_blank">joao.carvalho@ic.unicamp.br</a><br><a href="mailto:j160924@dac.unicamp.br" target="_blank">j160924@dac.unicamp.br</a></div></div></div></div></div></div></div></div></div></div></div></div></div>