<div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Fri, 20 Sep 2019, 10:14 Keane, Erich via cfe-dev, <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_6547538665035023252WordSection1">
<p class="MsoNormal">I decided to investigate <a href="https://bugs.llvm.org/show_bug.cgi?id=43370" target="_blank" rel="noreferrer">
https://bugs.llvm.org/show_bug.cgi?id=43370</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">First, this code is in a dependent context (but is not dependent itself):<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">uint64_t v[2];<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">    __atomic_store_n(v, 0, 0);<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The function template declaration in the AST shows the first parameter as having an ArrayToPointerDecay implicit cast.<u></u><u></u></p>
<p class="MsoNormal"><br>
However, the AtomicExpr transform calls “TransformExpr” on this, which then strips off all implicit casts. The expression then is NOT checked later, since it was already checked the first time.  If the expression is dependent, it gets properly checked, and
 the cast is added back in.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">It seems to me that transforming a dependent expression should be unnecessary at best, and a risk of crashing at worst (due to running out of Transform stack space).  SO, I put a test in the beginning of TransformExpr to just return the
 expr.</p></div></div></blockquote></div><div dir="auto">It is necessary in some cases (including this one): we need to rewrite the reference to 'v' to refer to the instantiated variable rather than the variable in the template.</div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div class="m_6547538665035023252WordSection1">
<p class="MsoNormal">However, check-clang resulted in 600+ test failures.  I evaluated a couple, and all seem to be because they are re-checking a statement that doesn’t need to be (since it isn’t dependent!).  There is unfortunately no good way it seems to
 determine whether a Stmt is dependent, so I can’t find anything to put into TransformStmt to skip like before.  So, I think I will have to manage these tests 1 by 1.<u></u><u></u></p>
<p class="MsoNormal"><br>
Before I deep-dive into this, I’d like to hear whether I’m missing something obvious and would just be wasting my time?  Does anyone know whether there is a good reason to still transform non-dependent expressions?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<br>
Erich<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" rel="noreferrer">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>