From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3396045565 for ; Wed, 1 Feb 2023 13:48:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F95A68BDD4; Wed, 1 Feb 2023 15:48:19 +0200 (EET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2094.outbound.protection.outlook.com [40.92.91.94]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B8C5368BD38 for ; Wed, 1 Feb 2023 15:48:12 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OQEw6sySx5qWp9miYUjUc1wi7lAu7nqDRLICeOHu+CqkJPXfbvi+jn+eqLbBYcDL/bhu4s53TUp9OJcMI/SZRCLhLkmJOp9Vs9pELW5JpGfisL39yoBQHWQBkSdLWsxPXt6vfaFVfms/LHdF8qIVDkdUeOkAMicgGOXhEmuNPFV9Qpzv9B5sa04kDgqLf76wIkIwpmWBlfmHkaki+FMAtBMSw5yCL6f8v2iZpg/vuHnzDHzhC9RnOB2CCGoG2VygkA7JhrPCllyW8aYoCGEIwcVykdqj+r5E90GTxUPu/z1xe9QXrnwrhZMtkuBdVjJk9dLbdTZsiJDMYFNZHMARvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QOF/7m0Cnra46zB12tpRUWpkX4iGkMgLMD7ITETTux4=; b=O1jVFvf6ENHsfc7LzB5HTD09T2matdipJEkEGR1dhHfpRteEhbb6C1O54VmK73VStB7FSY7uY1rQzD1dq+5VdYSKLzjOuSvFRsuJV4LdW3Liits73ZR80/q1sjfvQAyrtsRAQSq8AnZe3GU3d6csiEZ1JKUAa7ZvYlZw2ZuPK+cH4FIDzAAl1YEXwCEcuRdC/Z5Dfc3A5t3aCDclxuVg7uwjIHFOzdmJPLC7SDgw89M2MlwE9NlU1R1vwZaA2AuqbHFQI/8ED/dt4j34Ykj+IDdAjnPQd9vRLOqlkvUGVC6eVWOnv2mT2EHU/p1iGchvNXMgBmONdlj9KAMxRWCAdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QOF/7m0Cnra46zB12tpRUWpkX4iGkMgLMD7ITETTux4=; b=jKeRvnyZnyLeol+1xlBoPQg9K++H1PA+FqdifTqrbyNTIuC8SHYjjJq9MLgoVW0DJPDEuEApXn/t7PQo3mDOQdxtnAD+IDu/khwhly3d9XaXPKMJFijEnjbflSK8sqeYQ8az6FjD/PmA8eSq0ATrmFVwZZ1ydGmrbElx9OM87GnSVT6XChpOy6YK6kIwWZFRNa58fZ4VQ7uPqt6izCBpAfVpfcaPmqY1YqCWHTXkTdSn9lsDPA9+J2kzy/fcmDn5sC/yNW+Rt8gMB9wF5qZZN6rL287dok3UfDJVJUvaZ1TmsG8Pv/y2TphqI3Rgbp0/01gN5n46xWdmX4jvFZBPXg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS8P250MB0937.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5a0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Wed, 1 Feb 2023 13:48:10 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::a65f:2ae7:256a:ab96]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::a65f:2ae7:256a:ab96%9]) with mapi id 15.20.6002.033; Wed, 1 Feb 2023 13:48:10 +0000 Message-ID: Date: Wed, 1 Feb 2023 14:48:39 +0100 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <167517302897.4503.15130184316413800795@lain.khirnov.net> <167517470800.4503.4882536660599256492@lain.khirnov.net> <167517869808.4503.13103529212008047943@lain.khirnov.net> From: Andreas Rheinhardt In-Reply-To: X-TMN: [X5IfJtQqgHUhDt2gmcm/EKLgk7TE8S1t] X-ClientProxiedBy: ZR0P278CA0083.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::16) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS8P250MB0937:EE_ X-MS-Office365-Filtering-Correlation-Id: 450882e9-d101-4544-93b9-08db045af4a6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1d12TtvZTZiOVSUgYWbUCAmqBrVQACClivu0x9Fjj2MRB/nwTRJe18gMTA8rq92UhdA06xzmyPQ5/D28GW32yYEMRBWn8T7MVxpODPUssBlozC8siI0VGhfLFNdchV7mNMoVe2taJGVEGwcAGlhyt0qkLCnvkH76x57DixVNpAvbqivp5a/v+CuA7K94WO5f6sQdrN0404wZfFJoBIptH7C2soQUAp5AwiZE7xarDTf8HCuN8WtzB/KHkrcHUIiT2Sm6zshrGC7rKnG4h1IVv02FDbMDFh49TpLQT+PSxMjzj0Z6xNTE6Esg7vvbZP9uJqii0O7zZSPei21m8Pi54bLNKyLB4atxrwXsln+q/Y64rvZcQk6ZFf12odV4NbrTlKCCbErDwLraB36O6zBq4V7hUTdzO5lsmRbrsC3zuO8WKkLUSRkbB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WFRL3FEbTN6SXlYVXZhWmVYZDc4aktzeDdI?= =?utf-8?B?VVdVeXIwdUl1WWFxTWVpUmtTbDBGTFhoQklSaFhEVDdUcWJKY005Wko0VUVl?= =?utf-8?B?K0p1dDRKckJpZE9aZEk4T1dMeEo5QXZzUnh2eE9lbzV3NlNkRkFNQ2xTamRn?= =?utf-8?B?TVZnTmZJVmhhZ2pWbnp0WGZpbGZueDg4WDlkU3E0eHNhQXpzbkF4OFFkdDRt?= =?utf-8?Q?v78PhAh+e2XqqPzZdI=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 450882e9-d101-4544-93b9-08db045af4a6 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 13:48:10.4943 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P250MB0937 Subject: Re: [FFmpeg-devel] [PATCH] lavfi: get rid of FF_INTERNAL_FIELDS X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Nicolas George: > Andreas Rheinhardt (12023-02-01): >> PS: Upon rethinking, it is not only b) that contains undefined >> behaviour; it is b)-d) as well as the current code. The reason is that >> the type of AVFilterLink as seen in the files with FF_INTERNAL_FIELDS is >> not compatible with the type of AVFilterLink from the files without >> FF_INTERNAL_FIELDS. This also makes derived types, like the types of >> function declarations containing pointers to AVFilterLink incompatible >> and this is a violation of 6.2.7(2) of C11. I wonder if this will become >> a real problem with lto someday. > > No: read the second half of the previous paragraph: two structures with > common first fields are compatible types. What we have been using is a > deliberately supported construct. > "Moreover, two structure, union, or enumerated types declared in separate translation units are compatible if their tags and members satisfy the following requirements: If one is declared with a tag, the other shall be declared with the same tag. If both are completed anywhere within their respective translation units, then the following additional requirements apply: there shall be a one-to-one correspondence between their members such that each pair of corresponding members are declared with compatible types; if one member of the pair is declared with an alignment specifier, the other is declared with an equivalent alignment specifier; and if one member of the pair is declared with a name, the other is declared with the same name. For two structures, corresponding members shall be declared in the same order." 1. There is no one-to-one correspondence (aka a bijection) between the elements of the complete and of the public structure. 2. In the case of AVFilterLink, there is not even an injection from the public to the FF_INTERNAL_FIELDS structure (due to the former having a big reserved array). 3. The fact that these structures share a common initial sequence does not mean that this is legal. There are some guarantees regarding common initial sequences in 6.5.2.3 (6): "One special guarantee is made in order to simplify the use of unions: if a union contains several structures that share a common initial sequence (see below), and if the union object currently contains one of these structures, it is permitted to inspect the common initial part of any of them anywhere that a declaration of the completed type of the union is visible. Two structures share a common initial sequence if corresponding members have compatible types (and, for bit-fields, the same widths) for a sequence of one or more initial members." But there just is no union between the FF_INTERNAL_FIELDS !defined(FF_INTERNAL_FIELDS) structures in the whole codebase. Furthermore, said guarantee is only for inspecting, i.e. reading. For example, for the following two structs sharing a common initial sequence, struct Small { uint64_t foo; uint32_t bar; }; struct Big { uint64_t foo; uint32_t bar; uint32_t baz; }; if one had a union { struct Small; struct Big; }, a write to Small.bar may clobber Big.baz. - Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".