<div dir="ltr"><div dir="ltr">Hi Laurent, thank you for the patch.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 31, 2021 at 11:08 AM Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When compiling with optimization, gcc 9 and newer throw an unitialized<br>
variable warning:<br>
<br>
../../src/libcamera/pipeline/ipu3/imgu.cpp: In function ‘void libcamera::{anonymous}::calculateBDSHeight(libcamera::ImgUDevice::Pipe*, const libcamera::Size&, const libcamera::Size&, unsigned int, float)’:<br>
../../src/libcamera/pipeline/ipu3/imgu.cpp:172:17: error: ‘bdsHeight’ may be used uninitialized in this function [-Werror=maybe-uninitialized]<br>
  172 |    unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);<br>
<br>
Neither clang not gcc versions older than 9 complain. This seems to be<br>
a false positive, work around it by initializing the bdsHeight variable<br>
when declaring it.<br>
<br>
Note that there are obvious errors in the code, with the second while ()<br>
loop in the first part of calculateBDSHeight() modifying the bdsHeight<br>
variable set by the first loop even if the second loop doesn't find a<br>
suitable height, but that's out of scope for this fix.<br>
<br>
Signed-off-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br></blockquote><div><br></div><div>Reviewed-by: Hirokazu Honda <<a href="mailto:hiroh@chromium.org">hiroh@chromium.org</a>> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 src/libcamera/pipeline/ipu3/imgu.cpp | 2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp<br>
index 3e517ac67962..f3eaab648399 100644<br>
--- a/src/libcamera/pipeline/ipu3/imgu.cpp<br>
+++ b/src/libcamera/pipeline/ipu3/imgu.cpp<br>
@@ -126,7 +126,7 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc<br>
        unsigned int minIFHeight = iif.height - IF_CROP_MAX_H;<br>
        unsigned int minBDSHeight = gdc.height + FILTER_H * 2;<br>
        unsigned int ifHeight;<br>
-       float bdsHeight;<br>
+       float bdsHeight = 0.0f;<br>
<br>
        if (!isSameRatio(pipe->input, gdc)) {<br>
                unsigned int foundIfHeight = 0;<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
<br>
</blockquote></div></div>