Show a patch.

GET /api/1.1/patches/15760/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 15760,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15760/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15760/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20220429215841.19913-1-laurent.pinchart@ideasonboard.com>",
    "date": "2022-04-29T21:58:41",
    "name": "[libcamera-devel] libcamera: object: Silence gcc false positive error in release mode",
    "commit_ref": "4f1d1a48fe7ebe1282d7608a59cb059e1367e584",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "c65b311728314f60b9ae5153889c3f954b07049e",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/15760/mbox/",
    "series": [
        {
            "id": 3085,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3085/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3085",
            "date": "2022-04-29T21:58:41",
            "name": "[libcamera-devel] libcamera: object: Silence gcc false positive error in release mode",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3085/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15760/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15760/checks/",
    "tags": {},
    "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 ECFCFC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 29 Apr 2022 21:58:48 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 645FB604A5;\n\tFri, 29 Apr 2022 23:58:48 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 130B46042F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Apr 2022 23:58:46 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 820FE45F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Apr 2022 23:58:45 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651269528;\n\tbh=GKHBiSpE2wKUZicem31Wt7sxwNvoiLjnHze2MZV7JbE=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=nPBtXWG8rY3lzbR1V7TO86FcIR+maKntDx541onb1Ma0RxXRKp9EcKaX/ofBkv3m+\n\tugLv3HGH+U0jW/bdt2MK801kjzMl0rZDnveNDlgs5jJTBATohRoTWe/5GOi3fP0UU4\n\tNDphaDV5joHLP4Ths+zk+aixav+vZG7TagF0k+HrIBWlJL2Ty28eIFV2Rv9KHvrnCm\n\tL6n6vsjVjF3VqSwPDkJjMfyJu7aVNkOeu75AfoWrxTjtbe7O4GS3E1CblFCV+fbPhg\n\tr+wKXumhx3ZTRper+I6Qge7q7+qce73Hh1tagqXKtscQb5SD84B4CsE32SB1l7JqjM\n\tfVVJ3PZYqcYmQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1651269525;\n\tbh=GKHBiSpE2wKUZicem31Wt7sxwNvoiLjnHze2MZV7JbE=;\n\th=From:To:Subject:Date:From;\n\tb=p4IjbRuukbLd07iB9Zs/uw6p/hkRlD1uKzEU6I47G9GotktSmn2CeoZscgn5EdiJE\n\tEg3Oi3jTT8vG5mm4Llpz0ALpLlsJtCF9K3Puvtf70jMnbnBW7YIfchInSY97U6a50F\n\t8SJ01sPZS4BEwFPvZOaai27iPmNLv9fCiQubsmAQ="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"p4IjbRuu\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 30 Apr 2022 00:58:41 +0300",
        "Message-Id": "<20220429215841.19913-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.35.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] libcamera: object: Silence gcc false\n\tpositive error in release mode",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "gcc 10 and 11 produce an error when compiling libcamera in release mode:\n\nIn file included from ../../src/libcamera/base/object.cpp:13:\n../../include/libcamera/base/message.h: In member function ‘void libcamera::Object::notifyThreadMove()’:\n../../include/libcamera/base/message.h:58:47: error: array subscript ‘const libcamera::InvokeMessage[0]’ is partly outside array bounds of ‘libcamera::Message [1]’ [-Werror=array-bounds]\n   58 |         Semaphore *semaphore() const { return semaphore_; }\n      |                                               ^~~~~~~~~~\n../../src/libcamera/base/object.cpp:280:17: note: while referencing ‘msg’\n  280 |         Message msg(Message::ThreadMoveMessage);\n      |                 ^~~\n\nThis seems to be a false positive, given that msg->type() can never be\nequal to Message::InvokeMessage in Object::message() when called from\nObject::notifyThreadMove(), as the message is created there with the\nMessage::ThreadMoveMessage type. The problem as been reported in\nhttps://gcc.gnu.org/bugzilla/show_bug.cgi?id=105400, but the error\nnonetheless needs to be fixed without waiting for a new gcc release, and\na dynamic_cast does the job with a small additional runtime cost that\nshouldn't be a big issue, given that moving objects between threads is a\nrare operation.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=125\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/base/object.cpp | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/base/object.cpp b/src/libcamera/base/object.cpp\nindex ec5b55d125d1..92cecd22fbe9 100644\n--- a/src/libcamera/base/object.cpp\n+++ b/src/libcamera/base/object.cpp\n@@ -189,7 +189,11 @@ void Object::message(Message *msg)\n {\n \tswitch (msg->type()) {\n \tcase Message::InvokeMessage: {\n-\t\tInvokeMessage *iMsg = static_cast<InvokeMessage *>(msg);\n+\t\t/*\n+\t\t * A static_cast should be enough, but gcc 10 and 11 choke on\n+\t\t * it in release mode (with -O2 or -O3).\n+\t\t */\n+\t\tInvokeMessage *iMsg = dynamic_cast<InvokeMessage *>(msg);\n \t\tSemaphore *semaphore = iMsg->semaphore();\n \t\tiMsg->invoke();\n \n",
    "prefixes": [
        "libcamera-devel"
    ]
}