[{"id":17350,"web_url":"https://patchwork.libcamera.org/comment/17350/","msgid":"<CAO5uPHN_Am1GuKpHET+1iLdqdkAor=f7ijeLOdcG-Ya5uJu1Bg@mail.gmail.com>","date":"2021-05-31T03:15:45","subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: pipeline: ipu3: Fix\n\twarning when compiled with optimization","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Laurent, thank you for the patch.\n\nOn Mon, May 31, 2021 at 11:08 AM Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> When compiling with optimization, gcc 9 and newer throw an unitialized\n> variable warning:\n>\n> ../../src/libcamera/pipeline/ipu3/imgu.cpp: In function ‘void\n> libcamera::{anonymous}::calculateBDSHeight(libcamera::ImgUDevice::Pipe*,\n> const libcamera::Size&, const libcamera::Size&, unsigned int, float)’:\n> ../../src/libcamera/pipeline/ipu3/imgu.cpp:172:17: error: ‘bdsHeight’ may\n> be used uninitialized in this function [-Werror=maybe-uninitialized]\n>   172 |    unsigned int bdsIntHeight = static_cast<unsigned\n> int>(bdsHeight);\n>\n> Neither clang not gcc versions older than 9 complain. This seems to be\n> a false positive, work around it by initializing the bdsHeight variable\n> when declaring it.\n>\n> Note that there are obvious errors in the code, with the second while ()\n> loop in the first part of calculateBDSHeight() modifying the bdsHeight\n> variable set by the first loop even if the second loop doesn't find a\n> suitable height, but that's out of scope for this fix.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n> ---\n>  src/libcamera/pipeline/ipu3/imgu.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp\n> b/src/libcamera/pipeline/ipu3/imgu.cpp\n> index 3e517ac67962..f3eaab648399 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.cpp\n> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n> @@ -126,7 +126,7 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const\n> Size &iif, const Size &gdc\n>         unsigned int minIFHeight = iif.height - IF_CROP_MAX_H;\n>         unsigned int minBDSHeight = gdc.height + FILTER_H * 2;\n>         unsigned int ifHeight;\n> -       float bdsHeight;\n> +       float bdsHeight = 0.0f;\n>\n>         if (!isSameRatio(pipe->input, gdc)) {\n>                 unsigned int foundIfHeight = 0;\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6B8CFC3205\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 May 2021 03:15:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C565568925;\n\tMon, 31 May 2021 05:15:58 +0200 (CEST)","from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com\n\t[IPv6:2a00:1450:4864:20::52b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 98D4F602A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 May 2021 05:15:55 +0200 (CEST)","by mail-ed1-x52b.google.com with SMTP id u24so2273671edy.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 30 May 2021 20:15:55 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"V96RCohn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=u0NujbzcI2GHnCYLS2MtuxwIr3t7DcB3Ylw7aGZbdok=;\n\tb=V96RCohni+LWwzCsO6OGpDQ8PTITfyfvK2XhJdfuqc9XbXnjwdzDxuISvrkwyPjo27\n\tLMBbzOvh/2+S3XFjw56jV0bS/8dSpBTLaTgD/UrJSFkyk40Dxff2CyeSmxl4/F64q8XO\n\tdtjvqzj+OA7rhaQRXMhbU925D/jxs8whbwMd4=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=u0NujbzcI2GHnCYLS2MtuxwIr3t7DcB3Ylw7aGZbdok=;\n\tb=m4FF96fmUIusYgF2CDKwtX10gPYbEb7bLjznPEiMd3liDUHKG0WkziGOUlG+muCzXb\n\tzhSQ1FDjRdQ8l5JRDrLu6WngBih+4GUNDpXvTlQT3WuMyHrzKO8pun/j153JS3Hcv6Ru\n\ttD1eUQCFeOG9xwTWFrBrfgvjbWDxZvG5jrc/LvdeumbW63BhVfzkyAIg/ggtOs02MvMr\n\tZ78nrHygh+RNF1C4Wm30c+ZOUQyPlc/WFknmUsXsXKSlgc1rvXlmF6ZKJNKSvsAfDAfq\n\t6emopk+bmJWcp69/dQtIjOLunXqXgqogLTmtT5JGpc0H6S1Db3GsArczr10X6Cd162UB\n\tLWzw==","X-Gm-Message-State":"AOAM531JDRw+HqPicEEkbOciE7lihTSeyHkNO8TMVvdB68tFRGIWDavI\n\tLcN++6cGPWB1pLoEcgo6YDKv7AdAHtjifl9kvVY48ZgTqzc=","X-Google-Smtp-Source":"ABdhPJwPEUJPa8fv2aMuP8zsgg79r1EizwSyWNV0mBlhg7nNjSHqjmBDM7KIM+Q3JcDQbzeChZPXwffdKZI6crPccMI=","X-Received":"by 2002:a50:bec1:: with SMTP id\n\te1mr23257895edk.116.1622430955183; \n\tSun, 30 May 2021 20:15:55 -0700 (PDT)","MIME-Version":"1.0","References":"<20210531020745.13815-1-laurent.pinchart@ideasonboard.com>\n\t<20210531020745.13815-2-laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20210531020745.13815-2-laurent.pinchart@ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Mon, 31 May 2021 12:15:45 +0900","Message-ID":"<CAO5uPHN_Am1GuKpHET+1iLdqdkAor=f7ijeLOdcG-Ya5uJu1Bg@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000c1b05b05c397a4cb\"","Subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: pipeline: ipu3: Fix\n\twarning when compiled with optimization","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17358,"web_url":"https://patchwork.libcamera.org/comment/17358/","msgid":"<91fa97cd-4abc-a981-3a04-523326f6266e@ideasonboard.com>","date":"2021-05-31T18:26:47","subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: pipeline: ipu3: Fix\n\twarning when compiled with optimization","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 31/05/2021 04:07, Laurent Pinchart wrote:\n> When compiling with optimization, gcc 9 and newer throw an unitialized\n> variable warning:\n> \n> ../../src/libcamera/pipeline/ipu3/imgu.cpp: In function ‘void libcamera::{anonymous}::calculateBDSHeight(libcamera::ImgUDevice::Pipe*, const libcamera::Size&, const libcamera::Size&, unsigned int, float)’:\n> ../../src/libcamera/pipeline/ipu3/imgu.cpp:172:17: error: ‘bdsHeight’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n>   172 |    unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n> \n> Neither clang not gcc versions older than 9 complain. This seems to be\n> a false positive, work around it by initializing the bdsHeight variable\n> when declaring it.\n> \n> Note that there are obvious errors in the code, with the second while ()\n> loop in the first part of calculateBDSHeight() modifying the bdsHeight\n> variable set by the first loop even if the second loop doesn't find a\n> suitable height, but that's out of scope for this fix.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nTested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/ipu3/imgu.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\n> index 3e517ac67962..f3eaab648399 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.cpp\n> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n> @@ -126,7 +126,7 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc\n>  \tunsigned int minIFHeight = iif.height - IF_CROP_MAX_H;\n>  \tunsigned int minBDSHeight = gdc.height + FILTER_H * 2;\n>  \tunsigned int ifHeight;\n> -\tfloat bdsHeight;\n> +\tfloat bdsHeight = 0.0f;\n>  \n>  \tif (!isSameRatio(pipe->input, gdc)) {\n>  \t\tunsigned int foundIfHeight = 0;\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9D6B3C3205\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 May 2021 18:26:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E4FCC68921;\n\tMon, 31 May 2021 20:26:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A9B5602A8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 May 2021 20:26:48 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:c372:462d:cfcc:b7d1])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1029C6EF;\n\tMon, 31 May 2021 20:26:48 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"LR8Q8pPY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1622485608;\n\tbh=mfeBmbQnHsfQWItXB3VKnyyrmoy/wI7eyk+ewolJ5Lc=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=LR8Q8pPYc0rYJNRnuI9Anf/1NxycpmnhrCYnQXNcFC0CPA0bCZODeNNL8E2ljz19F\n\tvQjRxpwf9a3SAcAhhJ/1Mel7SgkiQxuQBafN4/5jMOCXSJyRN8u+XN0osc7pAQhIU5\n\toAE8ZfEZjIEWIODZfgAQhglsJqStOsWCEEalAbcQ=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210531020745.13815-1-laurent.pinchart@ideasonboard.com>\n\t<20210531020745.13815-2-laurent.pinchart@ideasonboard.com>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<91fa97cd-4abc-a981-3a04-523326f6266e@ideasonboard.com>","Date":"Mon, 31 May 2021 20:26:47 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.8.1","MIME-Version":"1.0","In-Reply-To":"<20210531020745.13815-2-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: pipeline: ipu3: Fix\n\twarning when compiled with optimization","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]