<html><body><p><tt>Hal Finkel <hfinkel@anl.gov> wrote on 05.02.2016 23:14:54:<br><br>> Just a general comment: I believe we've now fixed this bug for at <br>> least four different architectures (each time as a separate effort).<br></tt><br><tt>Yes.  Unfortunately I only noticed that after I'd already spent half</tt><br><tt>a day debugging the problem from scratch on System Z :-/</tt><br><br><tt>> Is there some kind of auditing we could do to make sure we don't run<br>> into this again?<br></tt><br><tt>Well, on GCC common code automatically predefines the macro if and</tt><br><tt>only if the back end actually implements the corresponding builtin</tt><br><tt>without an external function call.   We cannot really do that in LLVM</tt><br><tt>due to the stronger separation between front end and back end here.</tt><br><br><tt>However, I guess we could at least provide a *test case* that verifies</tt><br><tt>that front end and back end make the same choice.  This would have to</tt><br><tt>be a test case that runs a full compile (from un-preprocessed source</tt><br><tt>straight through to assembler output) so we can verify the interaction</tt><br><tt>of front end and back end, which I guess is frowned upon these days ...</tt><br><br><tt>The following example implements one idea I came up with:</tt><br><i>(See attached file: atomic-predefines.c)</i><br><br><tt>It is neither perfectly complete (it only checks the current target,</tt><br><tt>not all; and it doesn't check any variants of the current target,</tt><br><tt>e.g. different CPU types), nor is it perfectly safe (some targets</tt><br><tt>could theoretically emit weird code to implement a function call</tt><br><tt>that would throw off the heuristics in this test).</tt><br><br><tt>In addition, I noticed when running it against some of the more</tt><br><tt>obscure targets like Hexagon, the test actually triggers internal</tt><br><tt>errors in the back end, so those probably ought to be fixed first.</tt><br><br><tt>Any suggestions to improve this test welcome!</tt><br><br><br><tt>Bye,</tt><br><tt>Ulrich</tt><br><BR>
</body></html>