[{"id":26455,"web_url":"https://patchwork.libcamera.org/comment/26455/","msgid":"<Y+uLgbn+6fpfFsK6@pendragon.ideasonboard.com>","date":"2023-02-14T13:24:17","subject":"Re: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following\n\terrors with gcc-13","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Eric,\n\n(CC'ing Barnabás)\n\nThank you for the patch.\n\nOn Tue, Feb 14, 2023 at 12:14:49PM +0000, Eric Curtin via libcamera-devel wrote:\n> ../git/src/cam/file_sink.cpp:92:45: error: possibly dangling reference to a temporary [-Werror=dangling-reference]\n>    92 |                 const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n>       |                                             ^~~~\n> ../git/src/cam/file_sink.cpp:92:81: note: the temporary was destroyed at the end of the full expression '(& buffer->libcamera::FrameBuffer::metadata())->libcamera::FrameMetadata::planes().libcamera::Span<const libcamera::FrameMetadata::Plane>::operator[](i)'\n>    92 |                 const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n>       |                                                                                 ^\n> cc1plus: all warnings being treated as errors\n\nThis seems to be a false positive from an unreleased gcc version. Could\nyou report the issue to upstream gcc ? I'd like to get it fixed if it's\nindeed a false positive, or at least get confirmation from them that\nthey won't fix it.\n\n> Co-developed-by: Khem Raj <raj.khem@gmail.com>\n> Signed-off-by: Eric Curtin <ecurtin@redhat.com>\n> ---\n> Changes in v2:\n> \n> - Added const\n> - Made patch mergeable by accounting for new directory structure\n> ---\n>  src/apps/cam/file_sink.cpp | 9 ++++-----\n>  1 file changed, 4 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/apps/cam/file_sink.cpp b/src/apps/cam/file_sink.cpp\n> index b32aad24..d41569c9 100644\n> --- a/src/apps/cam/file_sink.cpp\n> +++ b/src/apps/cam/file_sink.cpp\n> @@ -114,13 +114,12 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer,\n>  \t}\n>  \n>  \tfor (unsigned int i = 0; i < buffer->planes().size(); ++i) {\n> -\t\tconst FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> -\n> +\t\tconst unsigned int bytesused = buffer->metadata().planes()[i].bytesused;\n>  \t\tSpan<uint8_t> data = image->data(i);\n> -\t\tunsigned int length = std::min<unsigned int>(meta.bytesused, data.size());\n> +\t\tconst unsigned int length = std::min<unsigned int>(bytesused, data.size());\n>  \n> -\t\tif (meta.bytesused > data.size())\n> -\t\t\tstd::cerr << \"payload size \" << meta.bytesused\n> +\t\tif (bytesused > data.size())\n> +\t\t\tstd::cerr << \"payload size \" << bytesused\n>  \t\t\t\t  << \" larger than plane size \" << data.size()\n>  \t\t\t\t  << std::endl;\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 2878EBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Feb 2023 13:24:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C590625F4;\n\tTue, 14 Feb 2023 14:24:19 +0100 (CET)","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 97859625DF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Feb 2023 14:24:18 +0100 (CET)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DB7663D7;\n\tTue, 14 Feb 2023 14:24:17 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1676381059;\n\tbh=lKrfaWxAsUVyv04Prbo4qryvO3fXEMbNdndaG9knSuU=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=xP0JLH0AEVxKhin9ZS1kY/DeFFvV5g3bm7Pv6EXa3WMEpr/RrsBeJ0ibLwbyzY+Lv\n\t2bCYeU4c80u4FjTj8lVXaYaiZARM819fpkgjj3U9UWzz6OrLtXSS+Y9/K0zU6HKa6c\n\tS1Dzo2irL86lvkJb+asBjSMl54fAGsYCmz9jFBXXHUWtj+tfRwtoxVCBfJZFuav/0P\n\tbfsf8rKk8zXMC7fer1/wiG8D0KvFkl5PtFNMJOo9xq15kRLqrlpC97y0WamIFxmSr/\n\tGkK08idJl04NB0FgJL5I6+mvPdIkWlCYn3Q5b9AbpYec5H8iKtCzQfpjCJnCW8rPEB\n\tSGoC/ZkHvYhgg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1676381058;\n\tbh=lKrfaWxAsUVyv04Prbo4qryvO3fXEMbNdndaG9knSuU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=CPeiafE83nzYJgUnQSZsI7FpTFKQA8cJY4NNvjUwcQotlAcQ9yQVeyTjDVXbsAruK\n\tPvpusR7xPbzE3muEtDfK57dBmjdLOeeE4YESLXhn1IsMBQYrK8aQd1DSDLMcyj8oRy\n\thrm5AzBpFWV/pkDr4UCNfxdmeEe4S7sVrhWJfrFY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"CPeiafE8\"; dkim-atps=neutral","Date":"Tue, 14 Feb 2023 15:24:17 +0200","To":"Eric Curtin <ecurtin@redhat.com>","Message-ID":"<Y+uLgbn+6fpfFsK6@pendragon.ideasonboard.com>","References":"<20230214121448.54918-1-ecurtin@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20230214121448.54918-1-ecurtin@redhat.com>","Subject":"Re: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following\n\terrors with gcc-13","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Khem Raj <raj.khem@gmail.com>,\n\twtaymans@redhat.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26456,"web_url":"https://patchwork.libcamera.org/comment/26456/","msgid":"<CAOgh=FznP0MFif=mJhrbny82ZzWzqD0t9NyQguYUA07rz5Aqzg@mail.gmail.com>","date":"2023-02-14T13:34:11","subject":"Re: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following\n\terrors with gcc-13","submitter":{"id":101,"url":"https://patchwork.libcamera.org/api/people/101/","name":"Eric Curtin","email":"ecurtin@redhat.com"},"content":"On Tue, 14 Feb 2023 at 13:24, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Eric,\n>\n> (CC'ing Barnabás)\n>\n> Thank you for the patch.\n>\n> On Tue, Feb 14, 2023 at 12:14:49PM +0000, Eric Curtin via libcamera-devel wrote:\n> > ../git/src/cam/file_sink.cpp:92:45: error: possibly dangling reference to a temporary [-Werror=dangling-reference]\n> >    92 |                 const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> >       |                                             ^~~~\n> > ../git/src/cam/file_sink.cpp:92:81: note: the temporary was destroyed at the end of the full expression '(& buffer->libcamera::FrameBuffer::metadata())->libcamera::FrameMetadata::planes().libcamera::Span<const libcamera::FrameMetadata::Plane>::operator[](i)'\n> >    92 |                 const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> >       |                                                                                 ^\n> > cc1plus: all warnings being treated as errors\n>\n> This seems to be a false positive from an unreleased gcc version. Could\n> you report the issue to upstream gcc ? I'd like to get it fixed if it's\n\nReported here:\n\nhttps://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532\n\nI added another poke.\n\n> indeed a false positive, or at least get confirmation from them that\n> they won't fix it.\n>\n> > Co-developed-by: Khem Raj <raj.khem@gmail.com>\n> > Signed-off-by: Eric Curtin <ecurtin@redhat.com>\n> > ---\n> > Changes in v2:\n> >\n> > - Added const\n> > - Made patch mergeable by accounting for new directory structure\n> > ---\n> >  src/apps/cam/file_sink.cpp | 9 ++++-----\n> >  1 file changed, 4 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/src/apps/cam/file_sink.cpp b/src/apps/cam/file_sink.cpp\n> > index b32aad24..d41569c9 100644\n> > --- a/src/apps/cam/file_sink.cpp\n> > +++ b/src/apps/cam/file_sink.cpp\n> > @@ -114,13 +114,12 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer,\n> >       }\n> >\n> >       for (unsigned int i = 0; i < buffer->planes().size(); ++i) {\n> > -             const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> > -\n> > +             const unsigned int bytesused = buffer->metadata().planes()[i].bytesused;\n> >               Span<uint8_t> data = image->data(i);\n> > -             unsigned int length = std::min<unsigned int>(meta.bytesused, data.size());\n> > +             const unsigned int length = std::min<unsigned int>(bytesused, data.size());\n> >\n> > -             if (meta.bytesused > data.size())\n> > -                     std::cerr << \"payload size \" << meta.bytesused\n> > +             if (bytesused > data.size())\n> > +                     std::cerr << \"payload size \" << bytesused\n> >                                 << \" larger than plane size \" << data.size()\n> >                                 << std::endl;\n> >\n>\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 5B567BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Feb 2023 13:34:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CDBC5625E3;\n\tTue, 14 Feb 2023 14:34:32 +0100 (CET)","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 E7238625DF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Feb 2023 14:34:30 +0100 (CET)","from mail-vk1-f197.google.com (mail-vk1-f197.google.com\n\t[209.85.221.197]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id\n\tus-mta-74-BAF0Ls-VOcuGbd622lXvnQ-1; Tue, 14 Feb 2023 08:34:28 -0500","by mail-vk1-f197.google.com with SMTP id\n\ti20-20020a056122209400b0040163d749ecso2647210vkd.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Feb 2023 05:34:28 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1676381672;\n\tbh=K9b+5OZzIKZZNbGcFnrQldI93rUb9Od/TzK/yzuYUHk=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=c3ZQdFdTk13k120Sw/QE+D618cQZRY/KEevRRoQ/YvJ24vidV6oM4lW3SfDs5OjCS\n\twDEKyudxxKCSZhWfC8fNsLxgKl+SAyZxkJFlaAEYl+x82KZgIq58W3BBgPbyWMhXrl\n\tzv8j4v6odeSrV7ZnqkN4wDdHOcokyVRgwwHgpjlh7m5r30j5d9Dr52MwEw6cRyRnwr\n\tzcYY+OhqvXHSWZbcD+Z3z65ZDo0cWxHePtgPDsdcC4j42TbLcF0hhBUUZ60iL3H25W\n\tYBxxTJUBRtLTpJ/zg9zkh87ywneXLzOi7cBX4MttIT5DDRkGlyroduaNpKA7fkx3sI\n\tWVZa9OyGYTrIA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1676381669;\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=bKEURwEWbB/KMPCeppyAL5vgacA9k52Ngvhmyzm8a0U=;\n\tb=Lv4OBbHrRmQ3HNaWoeVDYZrv9eZ3fjh2HqEWpL/6y5btnQgfI9374KFAGvtZWhhIEmtDL2\n\tLvJ0+YHeontbPl3i7VJFSB3qtsiENHtng8a+u2H4v6fpfrljagbHlPKY1QF1dnV7eWibRF\n\tlIgR8iCFARi2swX4YaW6lI/W27v+sp8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=redhat.com\n\theader.i=@redhat.com header.b=\"Lv4OBbHr\"; \n\tdkim-atps=neutral","X-MC-Unique":"BAF0Ls-VOcuGbd622lXvnQ-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1676381668;\n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=bKEURwEWbB/KMPCeppyAL5vgacA9k52Ngvhmyzm8a0U=;\n\tb=7Z0RAV+DHZnpKLN9ilIixXPaMtEl1Jy1NGeKdbbm2kRmTXsyKF5bTs/tbZokGcHThI\n\tH9wahtsoApEywrWgkZ0LzS07pqahYNnDcJGgPNsNkHM63KASa/DmK4UDNLrD6ijVX5FY\n\t9YxsguIiTXJ8Ffjex6b7RxzS+11dKPCeOsJZsv2YKa2UzoQsLhcAXUdX2hITBGEwxPKr\n\tF6HcVmGT4F8PRNyVn6/C6oDzcr2YWkjfJF3XEWBeOHi0FFYgyUoNbnm5HMgr/eAtcrPx\n\tQ4Dkmhx/apS2rynM+azfFgd1XEs8lGVCIZG0kkJlai7fCFEnhhz1Ok50xnZLkq0vv28/\n\t3+eA==","X-Gm-Message-State":"AO0yUKXi/VWr9js1y+LIPH4EmnEQcZgFhFhviVlIAjUMxoOVrEzC2LZ0\n\tglGc7ZKm0R8GxNoA5cRuOMIPfAPqoVvsCin0xqtMdCEKBcAojJ2jS+OT6bEytUsKXPANX5ee9nN\n\tdKwxYu3ngm9x2jwFs0LHZ0gPhsL3uU5yN/N+en+b5oqrBX8AOIw==","X-Received":["by 2002:a1f:2f93:0:b0:401:b0cc:f96f with SMTP id\n\tv141-20020a1f2f93000000b00401b0ccf96fmr383932vkv.11.1676381667818; \n\tTue, 14 Feb 2023 05:34:27 -0800 (PST)","by 2002:a1f:2f93:0:b0:401:b0cc:f96f with SMTP id\n\tv141-20020a1f2f93000000b00401b0ccf96fmr383926vkv.11.1676381667572;\n\tTue, 14 Feb 2023 05:34:27 -0800 (PST)"],"X-Google-Smtp-Source":"AK7set+8pRzA9LER7Eppfk1BTPqGAhumgmkLDOw3qrpGS02exzBvRM8j4J2nAcGmwt7eYMgMLoG50y+rBSqfGFKnIHU=","MIME-Version":"1.0","References":"<20230214121448.54918-1-ecurtin@redhat.com>\n\t<Y+uLgbn+6fpfFsK6@pendragon.ideasonboard.com>","In-Reply-To":"<Y+uLgbn+6fpfFsK6@pendragon.ideasonboard.com>","Date":"Tue, 14 Feb 2023 13:34:11 +0000","Message-ID":"<CAOgh=FznP0MFif=mJhrbny82ZzWzqD0t9NyQguYUA07rz5Aqzg@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Subject":"Re: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following\n\terrors with gcc-13","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>","From":"Eric Curtin via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Eric Curtin <ecurtin@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org, Khem Raj <raj.khem@gmail.com>,\n\twtaymans@redhat.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26460,"web_url":"https://patchwork.libcamera.org/comment/26460/","msgid":"<167676121599.1885751.4304614041247888116@Monstersaurus>","date":"2023-02-18T23:00:15","subject":"Re: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following\n\terrors with gcc-13","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Eric Curtin via libcamera-devel (2023-02-14 13:34:11)\n> On Tue, 14 Feb 2023 at 13:24, Laurent Pinchart\n> <laurent.pinchart@ideasonboard.com> wrote:\n> >\n> > Hi Eric,\n> >\n> > (CC'ing Barnabás)\n> >\n> > Thank you for the patch.\n> >\n> > On Tue, Feb 14, 2023 at 12:14:49PM +0000, Eric Curtin via libcamera-devel wrote:\n> > > ../git/src/cam/file_sink.cpp:92:45: error: possibly dangling reference to a temporary [-Werror=dangling-reference]\n> > >    92 |                 const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> > >       |                                             ^~~~\n> > > ../git/src/cam/file_sink.cpp:92:81: note: the temporary was destroyed at the end of the full expression '(& buffer->libcamera::FrameBuffer::metadata())->libcamera::FrameMetadata::planes().libcamera::Span<const libcamera::FrameMetadata::Plane>::operator[](i)'\n> > >    92 |                 const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> > >       |                                                                                 ^\n> > > cc1plus: all warnings being treated as errors\n> >\n> > This seems to be a false positive from an unreleased gcc version. Could\n> > you report the issue to upstream gcc ? I'd like to get it fixed if it's\n> \n> Reported here:\n> \n> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532\n> \n> I added another poke.\n> \n> > indeed a false positive, or at least get confirmation from them that\n> > they won't fix it.\n> >\n\nLet's add this here then:\n\nBug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532\n\n> > > Co-developed-by: Khem Raj <raj.khem@gmail.com>\n> > > Signed-off-by: Eric Curtin <ecurtin@redhat.com>\n> > > ---\n> > > Changes in v2:\n> > >\n> > > - Added const\n> > > - Made patch mergeable by accounting for new directory structure\n> > > ---\n> > >  src/apps/cam/file_sink.cpp | 9 ++++-----\n> > >  1 file changed, 4 insertions(+), 5 deletions(-)\n> > >\n> > > diff --git a/src/apps/cam/file_sink.cpp b/src/apps/cam/file_sink.cpp\n> > > index b32aad24..d41569c9 100644\n> > > --- a/src/apps/cam/file_sink.cpp\n> > > +++ b/src/apps/cam/file_sink.cpp\n> > > @@ -114,13 +114,12 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer,\n> > >       }\n> > >\n> > >       for (unsigned int i = 0; i < buffer->planes().size(); ++i) {\n\nI'd be tempted to add some sort of explainer here in a comment, but\nmaybe that's overkill if the bug does get fixed before GCC-13 is\nreleased...?\n\n> > > -             const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> > > -\n> > > +             const unsigned int bytesused = buffer->metadata().planes()[i].bytesused;\n> > >               Span<uint8_t> data = image->data(i);\n> > > -             unsigned int length = std::min<unsigned int>(meta.bytesused, data.size());\n> > > +             const unsigned int length = std::min<unsigned int>(bytesused, data.size());\n> > >\n> > > -             if (meta.bytesused > data.size())\n> > > -                     std::cerr << \"payload size \" << meta.bytesused\n> > > +             if (bytesused > data.size())\n> > > +                     std::cerr << \"payload size \" << bytesused\n\nOtherwise, the change itself seems fair, and does the 'same thing'...\nso:\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> > >                                 << \" larger than plane size \" << data.size()\n> > >                                 << std::endl;\n> > >\n> >\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 B9454BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 18 Feb 2023 23:00:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F164A62601;\n\tSun, 19 Feb 2023 00:00:21 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CCECF61EEA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 19 Feb 2023 00:00:19 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 06FDC77F;\n\tSun, 19 Feb 2023 00:00:18 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1676761222;\n\tbh=7cP4+JjnQ9xxpSIorADOXoK/uFD7dw44HPjABh/bkm0=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=kNJ6PR7YEe7NsqdPZByMIagCoAUpqX3mYkiRUnQEyDWDM4rW3F9Mp0eOoHdkOAujF\n\tyCe2t+DFZKryyE9dttYiQrbhoaWgZp55Oth9lMP92zt0WR6cIMp8YP7vY8QtSRDi5O\n\twnnRkO5iJjVJ8B08caiRMNdUy+g+un02VFM2b/l1fP5q5ZuHoDKjm8a33CQjKiIROD\n\t5TBNTksrPLByLAy6ZgIkGFsdnNOZvPdJ+zM0NXcoFpy32axjp9qVK+yQoH1HKkUSvU\n\tRsIjF+rND382TleRhQ9q2e6GpRZjULWP8gVoGs9G5KMcOQXj2vyfhKzQEsm33Pq7Ql\n\tVkhuHeawWy66Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1676761219;\n\tbh=7cP4+JjnQ9xxpSIorADOXoK/uFD7dw44HPjABh/bkm0=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=TBrCxWkrM7VdMv/RcNQGL3KUc/tjYZPOhX17QC7M+OSJVMLuVGWfnuHtrke4ogbyC\n\tV1JEue+dBpKmZK9fQM98sFT9nUDVjcHtnKk++Buw/UhN8EVZGmtivSC8pmUlt0J2rF\n\tKu5smaOnT5Gxk30cVsZCEZAEea/eOLZIEIXunCwo="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"TBrCxWkr\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<CAOgh=FznP0MFif=mJhrbny82ZzWzqD0t9NyQguYUA07rz5Aqzg@mail.gmail.com>","References":"<20230214121448.54918-1-ecurtin@redhat.com>\n\t<Y+uLgbn+6fpfFsK6@pendragon.ideasonboard.com>\n\t<CAOgh=FznP0MFif=mJhrbny82ZzWzqD0t9NyQguYUA07rz5Aqzg@mail.gmail.com>","To":"Eric Curtin <ecurtin@redhat.com>,\n\tEric Curtin via libcamera-devel <libcamera-devel@lists.libcamera.org>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Sat, 18 Feb 2023 23:00:15 +0000","Message-ID":"<167676121599.1885751.4304614041247888116@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following\n\terrors with gcc-13","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Khem Raj <raj.khem@gmail.com>,\n\twtaymans@redhat.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26600,"web_url":"https://patchwork.libcamera.org/comment/26600/","msgid":"<167831584831.3250497.14991181629718316485@Monstersaurus>","date":"2023-03-08T22:50:48","subject":"Re: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following\n\terrors with gcc-13","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2023-02-18 23:00:15)\n> Quoting Eric Curtin via libcamera-devel (2023-02-14 13:34:11)\n> > On Tue, 14 Feb 2023 at 13:24, Laurent Pinchart\n> > <laurent.pinchart@ideasonboard.com> wrote:\n> > >\n> > > Hi Eric,\n> > >\n> > > (CC'ing Barnabás)\n> > >\n> > > Thank you for the patch.\n> > >\n> > > On Tue, Feb 14, 2023 at 12:14:49PM +0000, Eric Curtin via libcamera-devel wrote:\n> > > > ../git/src/cam/file_sink.cpp:92:45: error: possibly dangling reference to a temporary [-Werror=dangling-reference]\n> > > >    92 |                 const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> > > >       |                                             ^~~~\n> > > > ../git/src/cam/file_sink.cpp:92:81: note: the temporary was destroyed at the end of the full expression '(& buffer->libcamera::FrameBuffer::metadata())->libcamera::FrameMetadata::planes().libcamera::Span<const libcamera::FrameMetadata::Plane>::operator[](i)'\n> > > >    92 |                 const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> > > >       |                                                                                 ^\n> > > > cc1plus: all warnings being treated as errors\n> > >\n> > > This seems to be a false positive from an unreleased gcc version. Could\n> > > you report the issue to upstream gcc ? I'd like to get it fixed if it's\n> > \n> > Reported here:\n> > \n> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532\n> > \n> > I added another poke.\n> > \n> > > indeed a false positive, or at least get confirmation from them that\n> > > they won't fix it.\n> > >\n> \n> Let's add this here then:\n> \n> Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532\n\nSo it seems from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532#c13\nthat the GCC-13 'bug fix' fixed the minimal test case, but possibly not\nthe false positive in libcamera.\n\nCan anyone else test to confirm?\n\n--\nKieran\n\n\n> \n> > > > Co-developed-by: Khem Raj <raj.khem@gmail.com>\n> > > > Signed-off-by: Eric Curtin <ecurtin@redhat.com>\n> > > > ---\n> > > > Changes in v2:\n> > > >\n> > > > - Added const\n> > > > - Made patch mergeable by accounting for new directory structure\n> > > > ---\n> > > >  src/apps/cam/file_sink.cpp | 9 ++++-----\n> > > >  1 file changed, 4 insertions(+), 5 deletions(-)\n> > > >\n> > > > diff --git a/src/apps/cam/file_sink.cpp b/src/apps/cam/file_sink.cpp\n> > > > index b32aad24..d41569c9 100644\n> > > > --- a/src/apps/cam/file_sink.cpp\n> > > > +++ b/src/apps/cam/file_sink.cpp\n> > > > @@ -114,13 +114,12 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer,\n> > > >       }\n> > > >\n> > > >       for (unsigned int i = 0; i < buffer->planes().size(); ++i) {\n> \n> I'd be tempted to add some sort of explainer here in a comment, but\n> maybe that's overkill if the bug does get fixed before GCC-13 is\n> released...?\n> \n> > > > -             const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n> > > > -\n> > > > +             const unsigned int bytesused = buffer->metadata().planes()[i].bytesused;\n> > > >               Span<uint8_t> data = image->data(i);\n> > > > -             unsigned int length = std::min<unsigned int>(meta.bytesused, data.size());\n> > > > +             const unsigned int length = std::min<unsigned int>(bytesused, data.size());\n> > > >\n> > > > -             if (meta.bytesused > data.size())\n> > > > -                     std::cerr << \"payload size \" << meta.bytesused\n> > > > +             if (bytesused > data.size())\n> > > > +                     std::cerr << \"payload size \" << bytesused\n> \n> Otherwise, the change itself seems fair, and does the 'same thing'...\n> so:\n> \n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> > > >                                 << \" larger than plane size \" << data.size()\n> > > >                                 << std::endl;\n> > > >\n> > >\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 307E9BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Mar 2023 22:50:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B055626C2;\n\tWed,  8 Mar 2023 23:50:52 +0100 (CET)","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 9D6DB62674\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Mar 2023 23:50:51 +0100 (CET)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0868010C;\n\tWed,  8 Mar 2023 23:50:50 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678315852;\n\tbh=kKhsLVQYMq2x2Psi6VIpKVCzivcfImnlOz9o2yyF0ek=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=vHMT+EIkJvmrKcN2YTP9ZH2x27ukZ2chg1lHvMu/m19cfpU1u7OfvrN+a1HarFB2/\n\tTb5kzVEmKRaQF4iMJQUpbIEOBu9VGW+aMrMyKYTK7eeGLIzWfOVV+P0wTzw58I5Jb9\n\tSCnbWRr9J3hvY9WYJVbCCxCzl9aRt8QVkUp7FNIv9PZaxuFrtXrZmbqj7idnxEQXIi\n\t7EnO76dYhwWcRjcu9UydLh8qGGAVwG4HAKcvOHKsRtPCwFCOAqPH9cDtf+0hYi8wRY\n\thtNE8Iwf+pcc6SbPfASO7gNftft7KKP1UJk3z56d5h2CLx4reK/PDys/zBX7Y+Oif1\n\tHSES9gwEr2QrQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1678315851;\n\tbh=kKhsLVQYMq2x2Psi6VIpKVCzivcfImnlOz9o2yyF0ek=;\n\th=In-Reply-To:References:Subject:From:To:Cc:Date:From;\n\tb=T6rdC90QBZXMF3e19fork1WkdEToDplIKHe8qkPSbmqEYvXqy4vov6eZX+QURm0In\n\t5eVP2GeI7ugM83ayoFh+Ia1/jEbopF8GL+xzcNi0WZXkki4+Ih5PJeCtzlfzHsfUtU\n\t7BFnuFGMtGH8lS3Z3tSXadPDpMKVzMZjqh55jx48="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"T6rdC90Q\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<167676121599.1885751.4304614041247888116@Monstersaurus>","References":"<20230214121448.54918-1-ecurtin@redhat.com>\n\t<Y+uLgbn+6fpfFsK6@pendragon.ideasonboard.com>\n\t<CAOgh=FznP0MFif=mJhrbny82ZzWzqD0t9NyQguYUA07rz5Aqzg@mail.gmail.com>\n\t<167676121599.1885751.4304614041247888116@Monstersaurus>","To":"Eric Curtin <ecurtin@redhat.com>,\n\tEric Curtin via libcamera-devel <libcamera-devel@lists.libcamera.org>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Wed, 08 Mar 2023 22:50:48 +0000","Message-ID":"<167831584831.3250497.14991181629718316485@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2] cam: file_sink: Fixes following\n\terrors with gcc-13","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Khem Raj <raj.khem@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]