[{"id":34321,"web_url":"https://patchwork.libcamera.org/comment/34321/","msgid":"<9e027169-fd69-4689-abbb-9efc1b7db419@ideasonboard.com>","date":"2025-05-22T12:53:57","subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 05. 22. 14:42 keltezéssel, Laurent Pinchart írta:\n> Some gcc versions report uninitialized variable usage:\n> \n> In member function ‘constexpr T& libcamera::Span<T, 4294967295>::operator[](size_type) const [with T = unsigned int]’,\n>      inlined from ‘void libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>)::MatrixAccessor::swap(unsigned int, unsigned int) [with T = float]’ at ../../src/libcamera/matrix.cpp:194:13,\n>      inlined from ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’ at ../../src/libcamera/matrix.cpp:255:14:\n> ../../include/libcamera/base/span.h:362:76: error: ‘row’ may be used uninitialized [-Werror=maybe-uninitialized]\n>    362 |         constexpr reference operator[](size_type idx) const { return data()[idx]; }\n>        |                                                                      ~~~~~~^\n> ../../src/libcamera/matrix.cpp: In function ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’:\n> ../../src/libcamera/matrix.cpp:232:30: note: ‘row’ was declared here\n>    232 |                 unsigned int row;\n>        |                              ^~~\n> \n> This is a false positive. Fix it by initializing the variable when\n> declaring it.\n> \n> Fixes: 6287ceff5aba (\"libcamera: matrix: Add inverse() function\")\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>   src/libcamera/matrix.cpp | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\n> index ed22263b58f8..b7c07e896538 100644\n> --- a/src/libcamera/matrix.cpp\n> +++ b/src/libcamera/matrix.cpp\n> @@ -229,7 +229,7 @@ bool matrixInvert(Span<const T> dataIn, Span<T> dataOut, unsigned int dim,\n>   \t\t * Locate the next pivot. To improve numerical stability, use\n>   \t\t * the row with the largest value in the pivot's column.\n>   \t\t */\n> -\t\tunsigned int row;\n> +\t\tunsigned int row = pivot;\n\nI am wondering if it could be set to `dim`, -1, etc. initially, and the below `if`\ncould be modified to check `row >= dim`, etc. That would avoid the value equality\ncheck, which I think is a good thing.\n\n\nRegards,\nBarnabás Pőcze\n\n\n>   \t\tT maxValue{ 0 };\n>   \n>   \t\tfor (unsigned int i = pivot; i < dim; ++i) {\n> \n> base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf","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 C3880BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 12:54:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9313C68D93;\n\tThu, 22 May 2025 14:54:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 21F3D68D8B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 14:54:02 +0200 (CEST)","from [192.168.33.22] (185.221.141.78.nat.pool.zt.hu\n\t[185.221.141.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7EA4D605;\n\tThu, 22 May 2025 14:53:39 +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=\"IqKcNwWS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747918419;\n\tbh=vbwcJRc3BzJSjBBV3Y57vwWOPhT+MmG0CrFk+1xA39c=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=IqKcNwWS5CdziUUzos4HBpZvJSCEVFe1Qt8dm0y+6ThFq9XZKoDVUsGazWHvLODph\n\tSZI+jyKkRoK/4eLcswAH9Hw57CczoUjPdsZWx3Eu2d4vEYUxL0eatKyW0LxGqDkVBo\n\tW4Tsz2Flq2H8TQnS3yzOrOmT+7eMht7b2yYnbdhc=","Message-ID":"<9e027169-fd69-4689-abbb-9efc1b7db419@ideasonboard.com>","Date":"Thu, 22 May 2025 14:53:57 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tMilan Zamazal <mzamazal@redhat.com>","References":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>"}},{"id":34322,"web_url":"https://patchwork.libcamera.org/comment/34322/","msgid":"<174791848527.3625350.2379301921237044675@ping.linuxembedded.co.uk>","date":"2025-05-22T12:54:45","subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2025-05-22 13:42:11)\n> Some gcc versions report uninitialized variable usage:\n> \n> In member function ‘constexpr T& libcamera::Span<T, 4294967295>::operator[](size_type) const [with T = unsigned int]’,\n>     inlined from ‘void libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>)::MatrixAccessor::swap(unsigned int, unsigned int) [with T = float]’ at ../../src/libcamera/matrix.cpp:194:13,\n>     inlined from ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’ at ../../src/libcamera/matrix.cpp:255:14:\n> ../../include/libcamera/base/span.h:362:76: error: ‘row’ may be used uninitialized [-Werror=maybe-uninitialized]\n>   362 |         constexpr reference operator[](size_type idx) const { return data()[idx]; }\n>       |                                                                      ~~~~~~^\n> ../../src/libcamera/matrix.cpp: In function ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’:\n> ../../src/libcamera/matrix.cpp:232:30: note: ‘row’ was declared here\n>   232 |                 unsigned int row;\n>       |                              ^~~\n> \n> This is a false positive. Fix it by initializing the variable when\n> declaring it.\n> \n> Fixes: 6287ceff5aba (\"libcamera: matrix: Add inverse() function\")\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/matrix.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\n> index ed22263b58f8..b7c07e896538 100644\n> --- a/src/libcamera/matrix.cpp\n> +++ b/src/libcamera/matrix.cpp\n> @@ -229,7 +229,7 @@ bool matrixInvert(Span<const T> dataIn, Span<T> dataOut, unsigned int dim,\n>                  * Locate the next pivot. To improve numerical stability, use\n>                  * the row with the largest value in the pivot's column.\n>                  */\n> -               unsigned int row;\n> +               unsigned int row = pivot;\n\n\nSeems to make sense, and workaround the toolchain.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>                 T maxValue{ 0 };\n>  \n>                 for (unsigned int i = pivot; i < dim; ++i) {\n> \n> base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf\n> -- \n> Regards,\n> \n> Laurent Pinchart\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 33E3ABD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 12:54:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DDA1168D93;\n\tThu, 22 May 2025 14:54:50 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 939B168D8B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 14:54:48 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 93D47605;\n\tThu, 22 May 2025 14:54:26 +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=\"URtqKOgt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747918466;\n\tbh=hcTYUuM+sXU4PNvJKmQGZnqIwrUbsb2FIBRHEcXX3Fs=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=URtqKOgtm+kKR6hDHq+8m6saUyZxPNt1XOquDCgmXTREbk6T/LMuBEaCYwTw6l14C\n\tLx+t//r1I+bxZ2k024bHnFJWbRJBWRoBHkGgnXWCs7nygW1CztDBg841APZ3lrOqRd\n\tUAToOoNww6hRyYvcs1gJgV4UcVducDIyrSPZ91iM=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>","References":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tMilan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 22 May 2025 13:54:45 +0100","Message-ID":"<174791848527.3625350.2379301921237044675@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}},{"id":34323,"web_url":"https://patchwork.libcamera.org/comment/34323/","msgid":"<20250522130206.GE2942@pendragon.ideasonboard.com>","date":"2025-05-22T13:02:06","subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, May 22, 2025 at 02:53:57PM +0200, Barnabás Pőcze wrote:\n> 2025. 05. 22. 14:42 keltezéssel, Laurent Pinchart írta:\n> > Some gcc versions report uninitialized variable usage:\n> > \n> > In member function ‘constexpr T& libcamera::Span<T, 4294967295>::operator[](size_type) const [with T = unsigned int]’,\n> >      inlined from ‘void libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>)::MatrixAccessor::swap(unsigned int, unsigned int) [with T = float]’ at ../../src/libcamera/matrix.cpp:194:13,\n> >      inlined from ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’ at ../../src/libcamera/matrix.cpp:255:14:\n> > ../../include/libcamera/base/span.h:362:76: error: ‘row’ may be used uninitialized [-Werror=maybe-uninitialized]\n> >    362 |         constexpr reference operator[](size_type idx) const { return data()[idx]; }\n> >        |                                                                      ~~~~~~^\n> > ../../src/libcamera/matrix.cpp: In function ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’:\n> > ../../src/libcamera/matrix.cpp:232:30: note: ‘row’ was declared here\n> >    232 |                 unsigned int row;\n> >        |                              ^~~\n> > \n> > This is a false positive. Fix it by initializing the variable when\n> > declaring it.\n> > \n> > Fixes: 6287ceff5aba (\"libcamera: matrix: Add inverse() function\")\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >   src/libcamera/matrix.cpp | 2 +-\n> >   1 file changed, 1 insertion(+), 1 deletion(-)\n> > \n> > diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\n> > index ed22263b58f8..b7c07e896538 100644\n> > --- a/src/libcamera/matrix.cpp\n> > +++ b/src/libcamera/matrix.cpp\n> > @@ -229,7 +229,7 @@ bool matrixInvert(Span<const T> dataIn, Span<T> dataOut, unsigned int dim,\n> >   \t\t * Locate the next pivot. To improve numerical stability, use\n> >   \t\t * the row with the largest value in the pivot's column.\n> >   \t\t */\n> > -\t\tunsigned int row;\n> > +\t\tunsigned int row = pivot;\n> \n> I am wondering if it could be set to `dim`, -1, etc. initially, and the below `if`\n> could be modified to check `row >= dim`, etc. That would avoid the value equality\n> check, which I think is a good thing.\n\nI've considered something similar. When trying to see if it was really a\nfalse positive, I wondered what would happen when all pivot elements are\n0, and then realized it means that the matrix isn't invertible. I've\ndecided to keep the value check, as I think it carries that meaning\nbetter than the row check.\n\nIs there another reason you think a row check would be better ?\n\n> >   \t\tT maxValue{ 0 };\n> >   \n> >   \t\tfor (unsigned int i = pivot; i < dim; ++i) {\n> > \n> > base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf","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 63F43C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 13:02:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9364968D8E;\n\tThu, 22 May 2025 15:02:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 69DFE68D8B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 15:02:13 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(179.218-130-109.adsl-dyn.isp.belgacom.be [109.130.218.179])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2EB088FA;\n\tThu, 22 May 2025 15:01:51 +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=\"tHdLk9YF\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747918911;\n\tbh=E0t0CIFZOtDF4/Oj9puAGRBVXAfh5J3JidWVNORlLAY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tHdLk9YFnuHYdqTEikMKj06IYo6ajXaWSstoKekaeFYrLM6y4iiBp5h3GCc+g+Rgc\n\tgDXl9V56EnVf4wwSvyTKivC6Uk9D4aKDw7IVU0E1kVpuvAAYC6WxQDhvJBXCUw8TRG\n\tj0ctKpW7ogen42brsXPlP52cUrzXfyJMeVDLxObM=","Date":"Thu, 22 May 2025 15:02:06 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tStefan Klug <stefan.klug@ideasonboard.com>,\n\tMilan Zamazal <mzamazal@redhat.com>","Subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","Message-ID":"<20250522130206.GE2942@pendragon.ideasonboard.com>","References":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>\n\t<9e027169-fd69-4689-abbb-9efc1b7db419@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<9e027169-fd69-4689-abbb-9efc1b7db419@ideasonboard.com>","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>"}},{"id":34324,"web_url":"https://patchwork.libcamera.org/comment/34324/","msgid":"<85sekweqth.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-05-22T13:08:10","subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Laurent,\n\nthank you for the fix.\n\nLaurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> Some gcc versions report uninitialized variable usage:\n>\n> In member function ‘constexpr T& libcamera::Span<T, 4294967295>::operator[](size_type) const [with T = unsigned int]’,\n>     inlined from ‘void libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>)::MatrixAccessor::swap(unsigned int, unsigned int) [with T = float]’ at ../../src/libcamera/matrix.cpp:194:13,\n>     inlined from ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’ at ../../src/libcamera/matrix.cpp:255:14:\n> ../../include/libcamera/base/span.h:362:76: error: ‘row’ may be used uninitialized [-Werror=maybe-uninitialized]\n>   362 |         constexpr reference operator[](size_type idx) const { return data()[idx]; }\n>       |                                                                      ~~~~~~^\n> ../../src/libcamera/matrix.cpp: In function ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’:\n> ../../src/libcamera/matrix.cpp:232:30: note: ‘row’ was declared here\n>   232 |                 unsigned int row;\n>       |                              ^~~\n>\n> This is a false positive. Fix it by initializing the variable when\n> declaring it.\n\nCompiles fine in my environment.\n\n> Fixes: 6287ceff5aba (\"libcamera: matrix: Add inverse() function\")\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/matrix.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\n> index ed22263b58f8..b7c07e896538 100644\n> --- a/src/libcamera/matrix.cpp\n> +++ b/src/libcamera/matrix.cpp\n> @@ -229,7 +229,7 @@ bool matrixInvert(Span<const T> dataIn, Span<T> dataOut, unsigned int dim,\n>  \t\t * Locate the next pivot. To improve numerical stability, use\n>  \t\t * the row with the largest value in the pivot's column.\n>  \t\t */\n> -\t\tunsigned int row;\n> +\t\tunsigned int row = pivot;\n>  \t\tT maxValue{ 0 };\n>  \n>  \t\tfor (unsigned int i = pivot; i < dim; ++i) {\n>\n> base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf","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 37505BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 13:08:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 65D9168D95;\n\tThu, 22 May 2025 15:08:19 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B59F268D8B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 15:08:17 +0200 (CEST)","from mail-ej1-f71.google.com (mail-ej1-f71.google.com\n\t[209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-615-3XUk43O-MSaLFTR7FQwK6A-1; Thu, 22 May 2025 09:08:15 -0400","by mail-ej1-f71.google.com with SMTP id\n\ta640c23a62f3a-ad52868da52so815180566b.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 06:08:15 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-ad52d06ddd6sm1096000066b.55.2025.05.22.06.08.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 22 May 2025 06:08:11 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"MfCoqqMW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1747919296;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=xnilbhl/eGMGY/m3i1jgSsPDGOnqerL5OpmXszTx6Hg=;\n\tb=MfCoqqMW6l+ZmyXqor9LwjPzh+WmbnntKPspLfPJmh3/+VqNGde3L2j3oNLzvBZfbJ9k2S\n\tbK9fThFo+29bRBre23kxln9jfSyhsJvo44wEOmc/bP5bIkZ9lemUAU+kHO1C5TaDozes9A\n\t35uI2UtcX5Z/P9YuliAm4RmUGaSnKAc=","X-MC-Unique":"3XUk43O-MSaLFTR7FQwK6A-1","X-Mimecast-MFC-AGG-ID":"3XUk43O-MSaLFTR7FQwK6A_1747919294","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1747919294; x=1748524094;\n\th=content-transfer-encoding:mime-version:user-agent:message-id:date\n\t:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=cLwHmdQr8JE/x3vXEfPEmCSzQ3p5dGsFBwzqbJA0jyI=;\n\tb=F0XONiaeXdsv3xMTA/QJqzlMNKPi2UWZ+hYBFrbEO1r5Q5roxJn19u8sZI6IH+GGId\n\t5GbhsduvFc5IjNx3PcOYIF/H7LASIjmmHAmfmQmd6jlEGrnkKimtfV7aYRYQBgf2qiRf\n\tmPJq59oAFT3Jy5TF6fV9KQf8SU/N8DTm253ngDGcLJb2pouyCzu8QER3mO0PRu/VBcpX\n\tyZxsAN7V/8B2FHn+CUdOwI/lWljjMzDCemU2Rtcn4UnPXote/HtkspJszkVrOUxV/wMk\n\tXFkAGmbIqeC7YdXakwNmzcEH8xmbn3r0FanpernX0vjQDpW1sCbCMDHMgXjHItKwYHW/\n\txf+g==","X-Gm-Message-State":"AOJu0YwqsUKi/hGs+hmFKJ63ETiIFB0oqVBs4nuJOoMJNy8N75LTdBQa\n\tXwhwpoxh0xC2OML+sj/KV56rA1pBI9VB1T9WsXaNB4Ya6zd8ibj8w3Z/BW454/pevXvs2D7X6t7\n\tt7hWE6yJknHtHGccPgO8W/x8sFM7HkNfugyWrluHGt42R8s8KlStjhsoD1FI5lDNCC4gjcLVtPS\n\tk=","X-Gm-Gg":"ASbGncudbMYjUixHS0OpIOSFKef21uHhIvu7aq5n+O4/sUWGEhXQWQ/8kqyF2qFH6Vu\n\tCY1tmOAsog1RmOxJo3auxstLk2SLpW3B9N4Nif65vtxEIc3NO6Xvuijv5VLnM/I4UfqgjGlD4r9\n\tKDlD0I7n5SVs8ouijhRUfPolw6qeAUoCkN/VeqxhBEmNYGVGSEgS9+ebYpqn4NE89GslgPht+jK\n\tUJ42XQItlnpAz9SlzWfBvFPH2gqEiQ8UsC1GYUEvHWJNFNt8CEUu7xGpqhvxs7UyWYqJt23e3K7\n\tZRiWFmwZiXdUlwPD/5Mv87+QQZ2O4CCfwkVaERTetZT3rMHd3+DJkaNxPymKPX8Z","X-Received":["by 2002:a17:907:9709:b0:ad5:5293:f2c8 with SMTP id\n\ta640c23a62f3a-ad55293f389mr1971817266b.15.1747919293900; \n\tThu, 22 May 2025 06:08:13 -0700 (PDT)","by 2002:a17:907:9709:b0:ad5:5293:f2c8 with SMTP id\n\ta640c23a62f3a-ad55293f389mr1971802266b.15.1747919291881; \n\tThu, 22 May 2025 06:08:11 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IGNR5KOPcC/O5IjctHBcnkWiECAsCavewiQ0ldsyszulDvrl1XQZGnC49zifdqPRCn52/BUlQ==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Stefan Klug\n\t<stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","In-Reply-To":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>\n\t(Laurent Pinchart's message of \"Thu, 22 May 2025 14:42:11 +0200\")","References":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>","Date":"Thu, 22 May 2025 15:08:10 +0200","Message-ID":"<85sekweqth.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"xBIT-g458epUEc9MLg5kYwhxd6PKKDeGUpR0tefZUWk_1747919294","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>"}},{"id":34325,"web_url":"https://patchwork.libcamera.org/comment/34325/","msgid":"<20250522132202.GP12514@pendragon.ideasonboard.com>","date":"2025-05-22T13:22:02","subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, May 22, 2025 at 03:08:10PM +0200, Milan Zamazal wrote:\n> Hi Laurent,\n> \n> thank you for the fix.\n> \n> Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n> \n> > Some gcc versions report uninitialized variable usage:\n> >\n> > In member function ‘constexpr T& libcamera::Span<T, 4294967295>::operator[](size_type) const [with T = unsigned int]’,\n> >     inlined from ‘void libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>)::MatrixAccessor::swap(unsigned int, unsigned int) [with T = float]’ at ../../src/libcamera/matrix.cpp:194:13,\n> >     inlined from ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’ at ../../src/libcamera/matrix.cpp:255:14:\n> > ../../include/libcamera/base/span.h:362:76: error: ‘row’ may be used uninitialized [-Werror=maybe-uninitialized]\n> >   362 |         constexpr reference operator[](size_type idx) const { return data()[idx]; }\n> >       |                                                                      ~~~~~~^\n> > ../../src/libcamera/matrix.cpp: In function ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’:\n> > ../../src/libcamera/matrix.cpp:232:30: note: ‘row’ was declared here\n> >   232 |                 unsigned int row;\n> >       |                              ^~~\n> >\n> > This is a false positive. Fix it by initializing the variable when\n> > declaring it.\n> \n> Compiles fine in my environment.\n\nCan I get a Tested-by: tag ?\n\n> > Fixes: 6287ceff5aba (\"libcamera: matrix: Add inverse() function\")\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/libcamera/matrix.cpp | 2 +-\n> >  1 file changed, 1 insertion(+), 1 deletion(-)\n> >\n> > diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\n> > index ed22263b58f8..b7c07e896538 100644\n> > --- a/src/libcamera/matrix.cpp\n> > +++ b/src/libcamera/matrix.cpp\n> > @@ -229,7 +229,7 @@ bool matrixInvert(Span<const T> dataIn, Span<T> dataOut, unsigned int dim,\n> >  \t\t * Locate the next pivot. To improve numerical stability, use\n> >  \t\t * the row with the largest value in the pivot's column.\n> >  \t\t */\n> > -\t\tunsigned int row;\n> > +\t\tunsigned int row = pivot;\n> >  \t\tT maxValue{ 0 };\n> >  \n> >  \t\tfor (unsigned int i = pivot; i < dim; ++i) {\n> >\n> > base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf\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 562E2C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 13:22:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3A8EA68D8E;\n\tThu, 22 May 2025 15:22:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A490D68D8B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 15:22:09 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(179.218-130-109.adsl-dyn.isp.belgacom.be [109.130.218.179])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7746F8FA;\n\tThu, 22 May 2025 15:21:47 +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=\"RV68oXAI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747920107;\n\tbh=T6CKrsXtLBQTBT6xJFpdpPs+2hyWRkuXsJFTUrv0PD4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=RV68oXAIYGyi4vQx7wmRZQ88NNvZcm0qRAy33IyQu/ir6VHvhjP+PHFb0QYf9uiSH\n\t588fHUYC13YIkKcXehgh2NF4MdJAZfWkoAVP862xAnAPtBO1y5uLS8xXL6+xjdteDV\n\tpi7Jj5LUoEv1VJwoLdo+kT+Iy7W2Hz9LrCs5L6v4=","Date":"Thu, 22 May 2025 15:22:02 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tStefan Klug <stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","Message-ID":"<20250522132202.GP12514@pendragon.ideasonboard.com>","References":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>\n\t<85sekweqth.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<85sekweqth.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","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>"}},{"id":34329,"web_url":"https://patchwork.libcamera.org/comment/34329/","msgid":"<b7b71ccf-7989-47a1-968b-0178b31dea46@ideasonboard.com>","date":"2025-05-22T13:39:59","subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 05. 22. 15:02 keltezéssel, Laurent Pinchart írta:\n> On Thu, May 22, 2025 at 02:53:57PM +0200, Barnabás Pőcze wrote:\n>> 2025. 05. 22. 14:42 keltezéssel, Laurent Pinchart írta:\n>>> Some gcc versions report uninitialized variable usage:\n>>>\n>>> In member function ‘constexpr T& libcamera::Span<T, 4294967295>::operator[](size_type) const [with T = unsigned int]’,\n>>>       inlined from ‘void libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>)::MatrixAccessor::swap(unsigned int, unsigned int) [with T = float]’ at ../../src/libcamera/matrix.cpp:194:13,\n>>>       inlined from ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’ at ../../src/libcamera/matrix.cpp:255:14:\n>>> ../../include/libcamera/base/span.h:362:76: error: ‘row’ may be used uninitialized [-Werror=maybe-uninitialized]\n>>>     362 |         constexpr reference operator[](size_type idx) const { return data()[idx]; }\n>>>         |                                                                      ~~~~~~^\n>>> ../../src/libcamera/matrix.cpp: In function ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’:\n>>> ../../src/libcamera/matrix.cpp:232:30: note: ‘row’ was declared here\n>>>     232 |                 unsigned int row;\n>>>         |                              ^~~\n>>>\n>>> This is a false positive. Fix it by initializing the variable when\n>>> declaring it.\n>>>\n>>> Fixes: 6287ceff5aba (\"libcamera: matrix: Add inverse() function\")\n>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>>> ---\n>>>    src/libcamera/matrix.cpp | 2 +-\n>>>    1 file changed, 1 insertion(+), 1 deletion(-)\n>>>\n>>> diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\n>>> index ed22263b58f8..b7c07e896538 100644\n>>> --- a/src/libcamera/matrix.cpp\n>>> +++ b/src/libcamera/matrix.cpp\n>>> @@ -229,7 +229,7 @@ bool matrixInvert(Span<const T> dataIn, Span<T> dataOut, unsigned int dim,\n>>>    \t\t * Locate the next pivot. To improve numerical stability, use\n>>>    \t\t * the row with the largest value in the pivot's column.\n>>>    \t\t */\n>>> -\t\tunsigned int row;\n>>> +\t\tunsigned int row = pivot;\n>>\n>> I am wondering if it could be set to `dim`, -1, etc. initially, and the below `if`\n>> could be modified to check `row >= dim`, etc. That would avoid the value equality\n>> check, which I think is a good thing.\n> \n> I've considered something similar. When trying to see if it was really a\n> false positive, I wondered what would happen when all pivot elements are\n> 0, and then realized it means that the matrix isn't invertible. I've\n> decided to keep the value check, as I think it carries that meaning\n> better than the row check.\n> \n> Is there another reason you think a row check would be better ?\n\nNothing concrete, but I find that floating points always need extra consideration,\nespecially regarding equality. I think it should work with 0, as it is currently,\nbut still, it's better not to have to even entertain the possibility of signalling\nnans, subnormals, etc.\n\nDisregarding the above, this patch fixes the compilation error for me as well.\n\nTested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\nRegards,\nBarnabás Pőcze\n\n\n> \n>>>    \t\tT maxValue{ 0 };\n>>>    \n>>>    \t\tfor (unsigned int i = pivot; i < dim; ++i) {\n>>>\n>>> base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf\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 218DABD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 13:40:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0449268D9A;\n\tThu, 22 May 2025 15:40:05 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9BCBC68D92\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 15:40:03 +0200 (CEST)","from [192.168.33.22] (185.221.141.78.nat.pool.zt.hu\n\t[185.221.141.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 28F1C8FA;\n\tThu, 22 May 2025 15:39:41 +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=\"N/E8ys5U\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747921181;\n\tbh=Mv03M5hSS/Q3Jkjwa6x6Uyz2SjRxkxFtOqmTvOeH4Bo=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=N/E8ys5UV6VvZKoKmkpc22i00QR8K/5hKvuwnTAHbf+emUyutOBrOmBoRKUvmiQ+8\n\tHL2WYRPUz4ySt9s31tsB8G0cTJ3FgAvR2ryMnTWNPlCNY4W6r/2WDVOa5wHyp9fiXO\n\t92YDvz8QLjYLApPUzsUUYNX72dRFnWGCtRWiW7cg=","Message-ID":"<b7b71ccf-7989-47a1-968b-0178b31dea46@ideasonboard.com>","Date":"Thu, 22 May 2025 15:39:59 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tStefan Klug <stefan.klug@ideasonboard.com>,\n\tMilan Zamazal <mzamazal@redhat.com>","References":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>\n\t<9e027169-fd69-4689-abbb-9efc1b7db419@ideasonboard.com>\n\t<20250522130206.GE2942@pendragon.ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250522130206.GE2942@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>"}},{"id":34331,"web_url":"https://patchwork.libcamera.org/comment/34331/","msgid":"<85o6vkeora.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-05-22T13:52:41","subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> On Thu, May 22, 2025 at 03:08:10PM +0200, Milan Zamazal wrote:\n>> Hi Laurent,\n>> \n>\n>> thank you for the fix.\n>> \n>> Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n>> \n>> > Some gcc versions report uninitialized variable usage:\n>> >\n>> > In member function ‘constexpr T& libcamera::Span<T, 4294967295>::operator[](size_type) const [with T = unsigned int]’,\n>> >     inlined from ‘void libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>)::MatrixAccessor::swap(unsigned int, unsigned int) [with T = float]’ at ../../src/libcamera/matrix.cpp:194:13,\n>> >     inlined from ‘bool libcamera::matrixInvert(Span<const T>, Span<T, 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’ at ../../src/libcamera/matrix.cpp:255:14:\n>> > ../../include/libcamera/base/span.h:362:76: error: ‘row’ may be used uninitialized [-Werror=maybe-uninitialized]\n>> >   362 |         constexpr reference operator[](size_type idx) const { return data()[idx]; }\n>> >       |                                                                      ~~~~~~^\n>> > ../../src/libcamera/matrix.cpp: In function ‘bool libcamera::matrixInvert(Span<const T>, Span<T,\n>> > 4294967295>, unsigned int, Span<T, 4294967295>, Span<unsigned int>) [with T = float]’:\n>> > ../../src/libcamera/matrix.cpp:232:30: note: ‘row’ was declared here\n>> >   232 |                 unsigned int row;\n>> >       |                              ^~~\n>> >\n>> > This is a false positive. Fix it by initializing the variable when\n>> > declaring it.\n>> \n>> Compiles fine in my environment.\n>\n> Can I get a Tested-by: tag ?\n\nTested-by: Milan Zamazal <mzamazal@redhat.com>\n\n>> > Fixes: 6287ceff5aba (\"libcamera: matrix: Add inverse() function\")\n>> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>> > ---\n>> >  src/libcamera/matrix.cpp | 2 +-\n>> >  1 file changed, 1 insertion(+), 1 deletion(-)\n>> >\n>> > diff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\n>> > index ed22263b58f8..b7c07e896538 100644\n>> > --- a/src/libcamera/matrix.cpp\n>> > +++ b/src/libcamera/matrix.cpp\n>> > @@ -229,7 +229,7 @@ bool matrixInvert(Span<const T> dataIn, Span<T> dataOut, unsigned int dim,\n>> >  \t\t * Locate the next pivot. To improve numerical stability, use\n>> >  \t\t * the row with the largest value in the pivot's column.\n>> >  \t\t */\n>> > -\t\tunsigned int row;\n>> > +\t\tunsigned int row = pivot;\n>> >  \t\tT maxValue{ 0 };\n>> >  \n>> >  \t\tfor (unsigned int i = pivot; i < dim; ++i) {\n>> >\n>> > base-commit: efdbe3969841e342c30dfdced38b6ad9ad55dccf\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 8950ABD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 13:52:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A09A168D96;\n\tThu, 22 May 2025 15:52:52 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D0BF968D8B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 15:52:50 +0200 (CEST)","from mail-wr1-f71.google.com (mail-wr1-f71.google.com\n\t[209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-328-GuGX9_yeM52je8C7iv_DZw-1; Thu, 22 May 2025 09:52:44 -0400","by mail-wr1-f71.google.com with SMTP id\n\tffacd0b85a97d-3a379218f6cso1568237f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 06:52:44 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3a367205338sm19753841f8f.98.2025.05.22.06.52.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 22 May 2025 06:52:41 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"griLWSNi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1747921967;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=akgVepv2290EGsLYyjZwaXecF/YaAFnX9DR4IfUV3Bs=;\n\tb=griLWSNiwH1XMEyWcIGI4t2Wc4N0tozgQD+ZZ1BEAlucI5KcKtPcu4S5zuoPvVK7DZ+4GN\n\tcutfMdDCurVfcVTxW8QEx3tcPRFCj7xibPAXGMKPmUTQLzOL0nQ1iJMKffvJg3SaDEBhYW\n\tT8PkbCh33LzVwaxqL0kHYcjwXdV0K+8=","X-MC-Unique":"GuGX9_yeM52je8C7iv_DZw-1","X-Mimecast-MFC-AGG-ID":"GuGX9_yeM52je8C7iv_DZw_1747921963","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1747921962; x=1748526762;\n\th=content-transfer-encoding:mime-version:user-agent:message-id:date\n\t:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=vp1eauk96tv18H272eYrHjZnUNxkn3ZeCqqFXDuJ6gY=;\n\tb=IKPKSi+A4o5CS8k8O+URJ/teHtoSNLhYcT38QY5h+Gug2G65xQLLSa2162KWV/ul67\n\tGxHh9PeEDwZvLmEYMoIjBgTVVupc28NSD/g4g8hdHbbY+uew7AupAxveTqGw/8sQAVVH\n\trEtKjzsA62G/Vs46K+m2Rzw9Aby6Y4/2nFJL1OL/VGNwQhrT/hQpL/m9+hvFsN957nqu\n\t1TsKo0Ts5lajZVInzhP21nG4Eq3JjLUksuFWDRzKhF3Z+3aN3skd24rezCGVSkEdm/g7\n\t1q138apP/38aySaHmKGPmUMAe6AnhvZwJjOqJIqt6hZrMkpGKQKsGW9KWsG+0tS4ROc0\n\tlbxg==","X-Gm-Message-State":"AOJu0Yyg5zfscmu9Uy7y13Ge8PkGIpK9pcpAhGyaM8cDlo8tOi8dEm4K\n\tpaDibKLZgbR3dR4FwJZLXfRP8A14vf9ngsFRK5xVqc/OoWhgkRvWYAbdLpbnnscsvCP+M636a5L\n\tUR/mFVTlQPocyltkJq5XpaW/KjJo9PVYvTCFAsU5AMEmwcjkYsKuLelycFqIPfmiPNKdABC4Hxt\n\tc=","X-Gm-Gg":"ASbGncvyLeg/XXfcb4uvARTmw6vuKw+sJG/ntvbMN0WK4yvLxQEzqiHj8KSPVoy8/aE\n\tCd0h3yItefCR2q8E7ow/q+NB+VTxbHrskkmII+ACyOrkDRziFPJClhForfd2JOALjrAygQei5TW\n\tL6iSQ8NNILyoUQjMbbffxaBVc893yc01otUJ+KZqlX7nF5llOgLS+fA+/nrAXkRa0YUurp04FeR\n\tx6SciAe+exiO2F2i4DpiirrQsau722ZDuNMzTfAHNj4mr7ci6vNhyoyg3U6DMLwMHhrTjsj/GVZ\n\ttZFhGZ6rn31dHijXBDUC+xnwxo+eEGeP1xzT8rM7y5AGN5fwx2bybMCAskcpfLBp","X-Received":["by 2002:a05:6000:2306:b0:3a3:6a3f:bc5d with SMTP id\n\tffacd0b85a97d-3a36a3fbdfcmr17184050f8f.1.1747921962620; \n\tThu, 22 May 2025 06:52:42 -0700 (PDT)","by 2002:a05:6000:2306:b0:3a3:6a3f:bc5d with SMTP id\n\tffacd0b85a97d-3a36a3fbdfcmr17184024f8f.1.1747921962288; \n\tThu, 22 May 2025 06:52:42 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IE5tdoCGiC8/jQPAnr1yZ5QlF8cFixXaHV4/p3w8z4KXrm60qEaMpguCrcXJcUSotAzYwotgg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Stefan Klug\n\t<stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH] libcamera: matrix: Fix compilation error in inverse()\n\tfunction","In-Reply-To":"<20250522132202.GP12514@pendragon.ideasonboard.com> (Laurent\n\tPinchart's message of \"Thu, 22 May 2025 15:22:02 +0200\")","References":"<20250522124211.2229-1-laurent.pinchart@ideasonboard.com>\n\t<85sekweqth.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>\n\t<20250522132202.GP12514@pendragon.ideasonboard.com>","Date":"Thu, 22 May 2025 15:52:41 +0200","Message-ID":"<85o6vkeora.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"GPRJW2V9u7szJuqf1lv6ZokUHBmFqwnLc8O8kqyp3HI_1747921963","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>"}}]