[Mesa-dev] [Bug 105755] Mesa freezes when the GLSL shader contains a `for` loop with an uninitialized `i` index/counter variable

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Mar 27 03:29:31 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=105755

--- Comment #11 from Ilia Mirkin <imirkin at alum.mit.edu> ---
As an aside... there's no compilation bug here. Perhaps $other driver happens
to get you a value of 0, but nothing guarantees that. Could just be luck in
precisely how they do RA. Certainly nothing in the spec.

And there are legitimate situations where a variable might be uninitialized
prior to (compiler-proven) use, e.g.

int x;
int y = 0;
loop {
  if (a)
    y += x;
  if (b)
    x = 5;
}

The compiler couldn't reasonably prove that a never happens before b does
(except in some circumstances).

Would it be the end of the world if one were to add code to zero-initialize all
variables? No - but it'd add unnecessary code to otherwise functioning shaders.

Mesa tends to stick to what's required by the spec.

(You could argue that the "shader has gone into infinite loop" case should be
handled better, with some success, but that's obviously a very
driver-backend-specific issue.)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180327/07381c14/attachment.html>


More information about the mesa-dev mailing list