softfloat: Silence a warning at -Og

../src/util/softfloat.c: In function ‘_mesa_shift_right_jam_m’:
   ../src/util/softfloat.c:432:16: warning: ‘tmp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     432 |         *tmp++ = 0;

You could actually hit this if you called _mesa_shift_right_jam_m with
size_words = 0 and dist < 32. Not that you'd _do_ that, but. In this
case do nothing instead of writing through an uninitialized pointer.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>
This commit is contained in:
Adam Jackson 2021-01-26 13:48:22 -05:00 committed by Marge Bot
parent fad353d7f8
commit f2b3ecb84f

View file

@ -393,6 +393,7 @@ _mesa_shift_right_jam_m(uint8_t size_words, const uint32_t *a, uint32_t dist, ui
word_jam = 0;
word_dist = dist >> 5;
tmp = NULL;
if (word_dist) {
if (size_words < word_dist)
word_dist = size_words;
@ -428,10 +429,12 @@ _mesa_shift_right_jam_m(uint8_t size_words, const uint32_t *a, uint32_t dist, ui
}
tmp = m_out + index_multiword_hi(size_words, word_dist);
}
do {
*tmp++ = 0;
--word_dist;
} while (word_dist);
if (tmp) {
do {
*tmp++ = 0;
--word_dist;
} while (word_dist);
}
if (word_jam)
m_out[index_word_lo(size_words)] |= 1;
}