Recursive array indexing where more than one array is used with non-constant indexing can lead to opt_array_splitting hitting an assertion after failing to realize that one of the arrays is not always accessed via constant indexing. This is present in master 1a469a34d517d4c2: $ bin/shader_runner opt_array_splitting_crash.test shader_runner: opt_array_splitting.cpp:296: void ir_array_splitting_visitor::split_deref(ir_dereference**): Assertion `constant' failed. Aborted (core dumped) I'll attach the offending shader runner test.
Created attachment 114380 [details] shader runner test file triggering the assertion Notice that even if the crash is fixed the test won't pass with current master. For the test to pass we need to support recursive reladdr scratch access, which I implement here: http://lists.freedesktop.org/archives/mesa-dev/2015-March/079631.html If the crash is fixed and that patch is applied then the test should pass. I can get the test to pass with that patch by disabling the optimization pass to work around the assertion.
Patch sent for review: http://lists.freedesktop.org/archives/mesa-dev/2015-September/094355.html
Fixed by: commit 4a600024242be2b8684ab2cc215171f31db594b0 glsl/opt_array_splitting: Fix crash when doing array indexing into other arrays When we find indirect indexing into an array, the current implementation of the array spliiting optimization pass does not look further into the expression tree. However, if the variable expression involves variable indexing into other arrays, we can miss that these other arrays also have variable indexing. If that happens, the pass will crash later on after hitting an assertion put there to ensure that split arrays are in fact always indexed via constants: shader_runner: opt_array_splitting.cpp:296: void ir_array_splitting_visitor::split_deref(ir_dereference**): Assertion `constant' failed. This patch fixes the problem by letting the pass step into the variable index expression to identify these cases properly. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89607 Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.