On Thu, 2016-11-03 at 12:23 -0700, Ian Romanick wrote: > I'm also a little curious how we get to this point with locp being > NULL. > Some commentary about that should at least go in the commit message.
So here is the reason. Mesa initializes parser->version as 0. When finalizes parsing the shader, if it didn't set explicitly the version it adds it implicitly. Mesa knows it if parser->version != 0. As this code is added implicitly, the locp in this case is NULL. But the problem with this test is that user defines #version 0. So Mesa doesn't realize version was set, and tries to implicitly adds the version. But version was defined before, so it shows the error that version is redefined. Problem? As said above, with the implicit code locp is NULL, hence the error. After thinking about it, I think this could be fixed if parser->version is initialized to a value that we know user can't set it. In this case, initializing to -1. This would mean changing the parser->version type to int instead of uint. But this is not a problem. So I withdraw this patch and will submit a new one. J.A. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev