On 2 August 2011 18:11, Ian Romanick <i...@freedesktop.org> wrote: >> On 1 August 2011 22:16, Paul Berry <stereotype...@gmail.com> wrote: >> 4. Since the linker emits functions at the head of the final linked >> program, if the linker brings in a function (let's call it f()) that >> wasn't declared in the compilation unit that defined main, it winds up >> at the beginning of the linked output, _before_ any global >> declarations. If f() refers to a global variable, then the IR is >> invalid, because ir_dereference_variable nodes need to occur _after_ >> the variables they declare (see ir_validate.cpp line 96). > > It seems like it would be worth constructing a test case for this. A > piglit test would be preferable. If that's not possible, a unit test > would do.
Agreed. As we discussed in person, the easiest way to test this seems to be to add Mesa code that validates the IR after linking, and a piglit test that exercises the test case in question. Plus, of course a Mesa patch that fixes the bug :) I'll send these patches to the respective mailing lists shortly. >> Does this analysis seem right to you, Ian? > > Paul, you continue to impress me. Yeah, that all sounds right. I had a > hard time believing #1 because I really thought I had implemented the > algorithm from my previous post. Of course, the code and commit logs > don't lie. I had thought of #5 shortly after hitting send, but I > decided it was too contrived to post a follow-up. Thanks, Ian. I really appreciate the positive feedback. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev