From: Nicolai Hähnle <nicolai.haeh...@amd.com>

This avoids undefined downcasting of list sentinels that crashes gcc's ubsan.

v2: don't use a new macro (Ian Romanick)
---
 src/compiler/glsl/opt_tree_grafting.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/opt_tree_grafting.cpp 
b/src/compiler/glsl/opt_tree_grafting.cpp
index b9db41b..60840b0 100644
--- a/src/compiler/glsl/opt_tree_grafting.cpp
+++ b/src/compiler/glsl/opt_tree_grafting.cpp
@@ -323,9 +323,10 @@ try_tree_grafting(ir_assignment *start,
       fprintf(stderr, "\n");
    }
 
-   for (ir_instruction *ir = (ir_instruction *)start->next;
-       ir != bb_last->next;
-       ir = (ir_instruction *)ir->next) {
+   for (exec_node *node = start->next;
+        node != bb_last->next;
+        node = node->next) {
+      ir_instruction *const ir = (ir_instruction *) node;
 
       if (debug) {
         fprintf(stderr, "- ");
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to