<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 18, 2016 at 10:27 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thursday, September 15, 2016 9:00:35 PM PDT Jason Ekstrand wrote:<br>
> ---<br>
>  src/compiler/glsl/list.h | 9 +++++++++<br>
>  1 file changed, 9 insertions(+)<br>
><br>
> diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h<br>
> index b5b5b36..8371519 100644<br>
> --- a/src/compiler/glsl/list.h<br>
> +++ b/src/compiler/glsl/list.h<br>
> @@ -714,6 +714,15 @@ inline void exec_node::insert_before(exec_<wbr>list *before)<br>
>          __node = __next, __next =                                          \<br>
>             exec_node_data(__type, (__next)->__field.next, __field))<br>
><br>
<br>
</span>Perhaps add:<br>
<br>
/* __after must be a valid list node (not the tail sentinel) */<br>
<br>
(if after is the tail sentinel, __node will be NULL, and then trying to<br>
obtain (__node)->__field.next will dereference that NULL pointer.)<br>
<br>
Either way, patch 1 is<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
<br>
(I haven't thought about patch 2, sorry)<br><div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br></div><div>I wouldn't bother for the moment.  I'm pretty sure it's broken and I think that Connor is right that trying to make block-splitting more deterministic is more-or-less a fool's errand.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
> +#define foreach_list_typed_safe_after(<wbr>__type, __node, __field, __after)    \<br>
> +   for (__type * __node =                                                  \<br>
> +           exec_node_data(__type, (__after)->__field.next, __field),       \<br>
> +               * __next =                                                  \<br>
> +           exec_node_data(__type, (__node)->__field.next, __field);        \<br>
> +        (__node)->__field.next != NULL;                                    \<br>
> +        __node = __next, __next =                                          \<br>
> +           exec_node_data(__type, (__next)->__field.next, __field))<br>
> +<br>
>  #define foreach_list_typed_reverse_<wbr>safe(__type, __node, __field, __list)   \<br>
>     for (__type * __node =                                                  \<br>
>             exec_node_data(__type, (__list)->tail_sentinel.prev, __field),  \<br>
><br>
<br>
</div></div></blockquote></div><br></div></div>