[PATCH 06/10] fb: Be more explicit about initializing shifts
Adam Jackson
ajax at redhat.com
Mon Mar 10 08:04:30 PDT 2014
gcc, in its finite wisdom, complains about:
fbblt.c: In function 'fbBltStip':
fbblt.c:645:38: warning: 'rightShiftOdd' may be used uninitialized in
this function [-Wmaybe-uninitialized]
bits1 |= FbScrRight(bits, rightShift);
^
fbblt.c:542:23: note: 'rightShiftOdd' was declared here
int leftShiftOdd, rightShiftOdd;
^
fbblt.c:643:27: warning: 'leftShiftOdd' may be used uninitialized in
this function [-Wmaybe-uninitialized]
bits1 = FbScrLeft(bits, leftShift);
^
fbblt.c:542:9: note: 'leftShiftOdd' was declared here
int leftShiftOdd, rightShiftOdd;
^
Now the branch this appears in shouldn't ever have a problem, since the
initializer only kicks in when sx != dx, and that's precisely this
branch. But either gcc isn't smart enough to notice that, or it's smart
enough to notice something I'm missing. Either way, when sx == dx the
shifts here should be 0.
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
fb/fbblt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fb/fbblt.c b/fb/fbblt.c
index 37bd912..471454a 100644
--- a/fb/fbblt.c
+++ b/fb/fbblt.c
@@ -36,6 +36,8 @@
rs = dx - sx; \
ls = FB_UNIT - rs; \
} \
+ } else { \
+ ls = rs = 0; \
} \
}
--
1.8.5.3
More information about the xorg-devel
mailing list