summary refs log tree commit diff stats
path: root/include/qemu/queue.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-02-04 16:40:18 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-02-05 16:50:21 +0100
commit5ed76a4c63db9295c6c5d67895925810050d4a46 (patch)
treef5f95ef0d7804f1a93c6817e6853790cc82be3e2 /include/qemu/queue.h
parent568534986486e619258c6ff36b4029372624238a (diff)
downloadfocaccia-qemu-5ed76a4c63db9295c6c5d67895925810050d4a46.tar.gz
focaccia-qemu-5ed76a4c63db9295c6c5d67895925810050d4a46.zip
queue: fix QTAILQ_FOREACH_REVERSE_SAFE
The iteration was stopping as soon as prev_var was set to NULL, and
therefore it skipped the first element.  Fortunately, or unfortunately,
we have only one use of QTAILQ_FOREACH_REVERSE_SAFE.  Thus this only
showed up as incorrect register preferences on the very first translation
block that was compiled.

Reported-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu/queue.h')
-rw-r--r--include/qemu/queue.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index 1f8e219412..0379bd8fdb 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -439,7 +439,7 @@ union {                                                                 \
 
 #define QTAILQ_FOREACH_REVERSE_SAFE(var, head, field, prev_var)         \
         for ((var) = QTAILQ_LAST(head);                                 \
-             (var) && ((prev_var) = QTAILQ_PREV(var, field));           \
+             (var) && ((prev_var) = QTAILQ_PREV(var, field), 1);        \
              (var) = (prev_var))
 
 /*