Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195226/?format=api
{ "id": 2195226, "url": "http://patchwork.ozlabs.org/api/patches/2195226/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260210153307.160978-2-chris.bazley@arm.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260210153307.160978-2-chris.bazley@arm.com>", "list_archive_url": null, "date": "2026-02-10T15:33:07", "name": "[v5,1/1] Add warnings of potentially-uninitialized padding bits", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4374b5c57ee18af9d5ee62117912586ddab80857", "submitter": { "id": 89471, "url": "http://patchwork.ozlabs.org/api/people/89471/?format=api", "name": "Christopher Bazley", "email": "Chris.Bazley@arm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260210153307.160978-2-chris.bazley@arm.com/mbox/", "series": [ { "id": 491691, "url": "http://patchwork.ozlabs.org/api/series/491691/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491691", "date": "2026-02-10T15:33:06", "name": "Add warnings of potentially-uninitialized padding bits", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/491691/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2195226/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195226/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256\n header.s=selector1 header.b=B9k2VtDQ;\n\tdkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com\n header.a=rsa-sha256 header.s=selector1 header.b=B9k2VtDQ;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256\n header.s=selector1 header.b=B9k2VtDQ;\n\tdkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com\n header.a=rsa-sha256 header.s=selector1 header.b=B9k2VtDQ", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=arm.com", "sourceware.org; spf=pass smtp.mailfrom=arm.com", "server2.sourceware.org;\n arc=pass smtp.remote-ip=52.101.72.41" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f9QcV1Kgyz1xwG\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 11 Feb 2026 02:35:22 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 201384BA23C9\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 15:35:20 +0000 (GMT)", "from AM0PR02CU008.outbound.protection.outlook.com\n (mail-westeuropeazon11013041.outbound.protection.outlook.com [52.101.72.41])\n by sourceware.org (Postfix) with ESMTPS id 947DB4BA2E10\n for <gcc-patches@gcc.gnu.org>; Tue, 10 Feb 2026 15:34:28 +0000 (GMT)", "from AS4P192CA0020.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:5e1::6)\n by FRZPR08MB11071.eurprd08.prod.outlook.com (2603:10a6:d10:13c::7) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.17; Tue, 10 Feb\n 2026 15:34:22 +0000", "from AM2PEPF0001C70B.eurprd05.prod.outlook.com\n (2603:10a6:20b:5e1:cafe::f8) by AS4P192CA0020.outlook.office365.com\n (2603:10a6:20b:5e1::6) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9611.8 via Frontend Transport; Tue,\n 10 Feb 2026 15:34:22 +0000", "from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by\n AM2PEPF0001C70B.mail.protection.outlook.com (10.167.16.199) with Microsoft\n SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9611.8\n via Frontend Transport; Tue, 10 Feb 2026 15:34:22 +0000", "from DB9PR02CA0005.eurprd02.prod.outlook.com (2603:10a6:10:1d9::10)\n by AS8PR08MB8298.eurprd08.prod.outlook.com (2603:10a6:20b:536::14)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9611.8; Tue, 10 Feb\n 2026 15:33:15 +0000", "from DU6PEPF0000A7E2.eurprd02.prod.outlook.com\n (2603:10a6:10:1d9:cafe::6b) by DB9PR02CA0005.outlook.office365.com\n (2603:10a6:10:1d9::10) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9611.8 via Frontend Transport; Tue,\n 10 Feb 2026 15:33:15 +0000", "from nebula.arm.com (172.205.89.229) by\n DU6PEPF0000A7E2.mail.protection.outlook.com (10.167.8.42) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.9611.8 via Frontend Transport; Tue, 10 Feb 2026 15:33:15 +0000", "from AZ-NEU-EXJ02.Arm.com (10.240.25.139) by AZ-NEU-EX04.Arm.com\n (10.240.25.138) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 10 Feb\n 2026 15:33:11 +0000", "from AZ-NEU-EX04.Arm.com (10.240.25.138) by AZ-NEU-EXJ02.Arm.com\n (10.240.25.139) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 10 Feb\n 2026 15:33:11 +0000", "from ip-10-248-139-165.eu-west-1.compute.internal (10.248.139.165)\n by mail.arm.com (10.240.25.138) with Microsoft SMTP Server id 15.2.2562.29\n via Frontend Transport; Tue, 10 Feb 2026 15:33:11 +0000" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 201384BA23C9", "OpenDKIM Filter v2.11.0 sourceware.org 947DB4BA2E10" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 947DB4BA2E10", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 947DB4BA2E10", "ARC-Seal": [ "i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1770737668; cv=pass;\n b=F+9QLEYLwzfZZux4NWUCYiHv11tdon70nM6kktB2gGOeWoS1xQvldgybMlZRLFZyWCTX0H5M4BJWhEcDpyNzCSHxUs27DQ4k157h06mLKheJfa2sP2yNFYwgAtI/hGBFKEEyGLhpN0WFL8+nz+5T7dccjcLSv9WpiOXppm1PS6Q=", "i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass;\n b=x7CRKwrHzXGfHwHaAA96d7466lveSBDXV9Quvk31gcM/BdguAlYRx4/GD7rJma9LIPigMkhnvvPA90MXIQ3rzL9p6vofEGQ//ffi9bvLCXEpmIXoigWPmky+5KVrIixeKY+NY7tk6Q7AVkxD/y2y+C/NkfrL56ff2Dujq4hykTqgaPU/InOT6LheBC6cOeA1LXGJzIMTyeU7c65nXCPpCNVgZKIHSuGxu7K+jlSflyKhzUvN6FD69IwjxyGf/WMeikyRG3hETc37MrMim/4wYmiwwZwKSSCuMDqDpcOKpjwEXrysrTqRfoMLDXD6MsCfiw0u5viE9b75Q3AXRqo31w==", "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=RjJ4ZhfvEpZw3O0j+GsxxaXfcwBwcCbhtuBvY2wXLFr7bpccajdMEn7qv75POE3+5hxwGmzsxT15xj7yU+Ys96LwMKoIi7OmHHRi7ib1hb9lzyu184exAnviN5P5pt4194Ln8kbwn+zi9tP4SUGkEe2iHLqc59OiFUw2suI9XsDFqPi0L4LhX96E/a8KqU+Hr08tKmmrsek/McA1g2ZadrKHXVdf26wb98Cv6TEkJWKDkh+QF7d6xa/hb/M93WIVne6dtv0Rpi9gYg143BaE1i2lPUBocuZfUcvIwdyhWSfL+VHXx3CeGAJ00W8ZxulB3Rb3MpXDB/nIiLZtevTVZQ==" ], "ARC-Message-Signature": [ "i=3; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770737668; c=relaxed/simple;\n bh=ydyKtfRKKSCOOFrvpDzbzvAnnUfoX2B7zIUj4tgTkj0=;\n h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID:\n MIME-Version;\n b=lFchA5jgUY1hWik+znxkiK5fl6Gh0DJqSfeox8wubBp7DOzbqmTNRnFSzdFSIoQhe4vsakZV1ph+n2EBEJuTh/+XQTXicnJK8ayKXpVCUFcVFyoy3NlRhSMmodck9ptuDTZnxXwmz+54ge4WU5snsS1BsSduIqSza20oBJYsH90=", "i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n 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;\n bh=UnNaNJTrN5HokWP3PpqJgepGYgqMo0kv9FKX0xexN28=;\n b=MU8iS4PSRgelIcF7N+z2Wp650/uB8E/ypXS7hFSqcJFAkv+3cVaGmXr56MIbX4+yPOvI5wKpevtoYJKJJeNV0nA4c524nnlKSbU0bSArm/5JIf0puc3sj/LSHq0yeCf/1nGfOSjwFZxv7bzL8lDhSMuP7MNQI8FTKIttbFvSI4TSlpeK016dDeXWYU/pWN6WhpsPaqp4K9OFuXKIonhxK7FPs3BWzhK8/yfoFq3PSvAtChsQQ/Sgapk/8aSmQ6YXfR1Rb+rnGik9prQ2xumlG+f161bdFtg1L8AcWu1WKhLBvSy/CJZDQK+b6m5blqzALBqbrPuzn5X3ShWo1Cnebw==", "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n 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;\n bh=UnNaNJTrN5HokWP3PpqJgepGYgqMo0kv9FKX0xexN28=;\n b=Ad8clKBY7d7c1zNEeKlUQTKOSEM+0pXMnkwyTPdJU80ud4gefDtgSYudv0bpAkdp72HMdz5NNcJ6uPqI+WbdDEfVQh/8Yr2PzHx36EpLw5ardvflfkIT1AnFFwp3oduONL0iyrfYOxdFY9JkgjjDoWP/Vy0yYBs4qhFIZMzfvkqVb1NdMJ96OPqwg2qSIs6qp938X5sJ/1BJNxwxuVz/lY4tUhpSTUgS91g5OYb5UAOnXji0TpXou+0q04OZGy3b+0lMfMOLJnaJ3G3yeitCXmKLMaO8gjpSfgamQ57zCx63fi8aq3EAa7eG5okU3h/G3drtaL23PODIyiGXaTW25Q==" ], "ARC-Authentication-Results": [ "i=3; server2.sourceware.org", "i=2; mx.microsoft.com 1; spf=pass (sender ip is\n 4.158.2.129) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass\n (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass\n (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1\n spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com])", "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 172.205.89.229) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com;\n dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com;\n dkim=none (message not signed); arc=none (0)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=UnNaNJTrN5HokWP3PpqJgepGYgqMo0kv9FKX0xexN28=;\n b=B9k2VtDQAbvaluD5VP/eos/LHq/QVwEnrXONSemXW6pMmepK/qBR5yZdaHsGodNG5gQOZPduL5NXqELSG3hUtquFdicfiX8lQJiOISeCgQDKGrdO8Ikol5ztHfLMXY9dR2XjaXv7c/rLPJz+XCZ8k7XAghVEfS787I85PzmmSfI=", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=UnNaNJTrN5HokWP3PpqJgepGYgqMo0kv9FKX0xexN28=;\n b=B9k2VtDQAbvaluD5VP/eos/LHq/QVwEnrXONSemXW6pMmepK/qBR5yZdaHsGodNG5gQOZPduL5NXqELSG3hUtquFdicfiX8lQJiOISeCgQDKGrdO8Ikol5ztHfLMXY9dR2XjaXv7c/rLPJz+XCZ8k7XAghVEfS787I85PzmmSfI=" ], "X-MS-Exchange-Authentication-Results": [ "spf=pass (sender IP is 4.158.2.129)\n smtp.mailfrom=arm.com; dkim=pass (signature was verified)\n header.d=arm.com;dmarc=pass action=none header.from=arm.com;", "spf=pass (sender IP is 172.205.89.229)\n smtp.mailfrom=arm.com; dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=arm.com;" ], "Received-SPF": [ "Pass (protection.outlook.com: domain of arm.com designates\n 4.158.2.129 as permitted sender) receiver=protection.outlook.com;\n client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C", "Pass (protection.outlook.com: domain of arm.com designates\n 172.205.89.229 as permitted sender) receiver=protection.outlook.com;\n client-ip=172.205.89.229; helo=nebula.arm.com; pr=C" ], "From": "Christopher Bazley <chris.bazley@arm.com>", "To": "<gcc-patches@gcc.gnu.org>", "CC": "<rguenther@suse.de>, <pinskia@gmail.com>, <jakub@redhat.com>,\n <andre.simoesdiasvieira@arm.com>, Christopher Bazley <chris.bazley@arm.com>", "Subject": "[PATCH v5 1/1] Add warnings of potentially-uninitialized padding bits", "Date": "Tue, 10 Feb 2026 15:33:07 +0000", "Message-ID": "<20260210153307.160978-2-chris.bazley@arm.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260210153307.160978-1-chris.bazley@arm.com>", "References": "<20260210153307.160978-1-chris.bazley@arm.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-EOPAttributedMessage": "1", "X-MS-TrafficTypeDiagnostic": "\n DU6PEPF0000A7E2:EE_|AS8PR08MB8298:EE_|AM2PEPF0001C70B:EE_|FRZPR08MB11071:EE_", "X-MS-Office365-Filtering-Correlation-Id": "c4eb3317-a3a1-4d92-8160-08de68b9dd61", "x-checkrecipientrouted": "true", "NoDisclaimer": "true", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam-Untrusted": "BCL:0;\n ARA:13230040|82310400026|1800799024|376014|36860700013|13003099007;", "X-Microsoft-Antispam-Message-Info-Original": "\n baWPmTz0MvhqSjA34+qlQ8Hq/+ECBDSR1Tx1dpHM16SZmp2S5zmcMhfeXE4AAfxfhzVpjxPkKs9rlNQNNb3NfuQ+hkY1U0JRBqV4MOR33ZfklsaV6RQuB+qASRCV0SmrRR0/+5u68LNPBmZ1bhiRRZsoTW0cFSKYLMTCoN4zdaTKxqPFFYl67fSAFQ+EV6t9gKOt3Vb5+PZ0LQzNkI/X703MHUEklDJi7q+i83LE5N0r8R6DoOX9wcUhqMDqn7Y/Abl6ubvDY3OxuQOf19twxF69xvDbFXYYQha8TfbA5KedM3OHCAd4TG22R/BIQEC1/OpmHnkzKiedQqmruaCBKAYoefkK2YtON6FPNo71CPzEN6RdClaZ7b8eCeT3JOVHCfdnd35A0qdpOhr6WMWfV3WL2Pm0/qwBRfE+cdbcupGg88jlqM3oP+k1Apl2H1SrCtHT0kVmWF1RKjjyhlEkWyRUE73HwuQi/wJVv/QV1/g4YDs1fw7chD+0eil54OKcAl8SszWl1uuYi3ZbTgCYMrORrlhmSK3URySf3fr+CeJbGbi0M7ZpGtmyi5x/51wqbA1P6tjGVl+KohITur7os/tUcJpEPfdMzcDSOq2WutVCQJK52T0IOuNKS7sDrE+KtOBwTf/P3DAbxpJeCZYzAj47d8/3nfCkCdiC+VQxXWzNZcGPn4gxrzNofFQbpeeYS8PpnEe7lFmBFdIjp4XM92kCXwApSVWq1pVZP0z6TkN2C6z9kUo8U2lSHVNDfGbC8ZL9QhZkmm3oNC1HTY4oSjTsgtXrVkXy17/6v/dHGZW6E/S3C+ZmG3OiTTUJEGo1aXjIHnp17IhbHdFwlMlSu+OVXn8d5XC5wiL897HbhswibQS8dw5FNWcU5iHLiexgY16jA62GhC8Jkb7bJy3vjW59XbjwZNXsKLokx0t09BEDtoJwi7bUE2cRvperu/k1OYoRBavuBx3/Eaml1toORoGtLmvHCWZ3FWvSQPX0FoMPcsT1505Fv0YzzYs4mqaV+5Hiqg3nM4O1VkK3ImkJ3tmWevTzA7448oYlVy9BUrWszhd8ZKicm0jHbs5ohRFhk9YshzeyVv7nNrhmk3FSpJ8gJz6XG57FEGQFacLswaBEvTDq6gGuIhNnDXrbG2ghaLFobWtRQyFCjaCG1nUuZRDKSJexYixBSpG0fsqUuNL5rijQN7gd1hr13SkGnEnG7vwCUO09C32x4NgazSaLnRHLWt+xqVpvw6kbL0N58f9zgc0vPxCEI+QgDqDhqVysQPtOZnt9e7tZPqMRZOeN7z565lHHevnOR7ikeeOoM8Ee1J3zSg7z9QYmFI4qF8kzgwB2cCu9+neJLIQtSvB1iONmHmyMIQ72lsvBxt2nqn/s0FGfOmFOWOlTj94+CQ5Wq7UXOQ27vOYEx4Uh13E6gvBkZ5ozcKpsCIXHWhdljD92XeuBtdZrWBk6FjwMz/Lb5wIOrJtXMXB1RqHblAyWeWqWlkIldQQq82xf7fexCYzWIXS+uJbpd6Jpnx2KIRkjL7buXi/LVqPYDO+Z+uEe/I1oyFMSmxZRUKrUJM8aIu2yN90B6bNTprfbJAoeadvbE04V6TTlJLN5DqmKuBzcUpeGd6bEJwcTzKIlcZ6BDuc=", "X-Forefront-Antispam-Report-Untrusted": "CIP:172.205.89.229; CTRY:IE; LANG:en;\n SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent;\n CAT:NONE;\n SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013)(13003099007);\n DIR:OUT; SFP:1101;", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": [ "AS8PR08MB8298", "FRZPR08MB11071" ], "X-MS-Exchange-Transport-CrossTenantHeadersStripped": "\n AM2PEPF0001C70B.eurprd05.prod.outlook.com", "X-MS-PublicTrafficType": "Email", "X-MS-Office365-Filtering-Correlation-Id-Prvs": "\n 33a288e7-8b82-44a2-a23d-08de68b9b592", "X-Microsoft-Antispam": "BCL:0;\n ARA:13230040|376014|1800799024|36860700013|35042699022|14060799003|82310400026|13003099007;", "X-Microsoft-Antispam-Message-Info": "\n yJLSKyI5fFICHNBzPDbF8G3nTc9E6FqrwIs270DhkYza1272dYPdczl0YK0H6fiE/dzmUXQ+Q1+ijXj3WgA/gQOsQrL4Z+qPlK/3kF4b/7jquB0Hfaz5V/b1I1BRWxby895baTAIBNOdXdAfDR9x4B8vf182K/ePlqOPMuF3eJ7703nsJKJGKvj/GYtyAQPiOoFhYEzj9e+/LRgS3a3v0H63vNopHY99W25oddcHzXOgRz6mmMBrjJR+bp9fDpyx4O/27nT95K5MIDxDtdy1XLChkAbhkK13TqcCklG/HRzVyxgNc2mrYfaSt1VazozQ85Dm2BtkA7uDt3kk4Wg+gallQkUYGgxrMFREE8GGDpxpXGhoY4iTejCKwOLwfpWj8KzmaJUZwya0lfgKJDN+FbK1J/DvkcyHCWwJJ4EpYFu/9vBcMiiQ9GJrlzW5Y2dF+Pa68GO1M5NRMX9YsYEbeLfQGfy5t5IEovNKxctfVa3edE6VzswST3lSi1wuK44DGR/NB5+w/fz5JtGa0crYB7LbR3RsY9UQ1U1g4g9gNuVkjtmYhk0KEOYczQuvy0Q8BRtXK/81k7p8rR5bAwNj8RfwvEmPyndR7/4O5C9atM2C6n+m8v1SLO7SfBdxbwwMu2maihKQrIVQ6gZpUZnF+rpWLqaaFiQg7sPSG/Dpbd2usQoTJzJ8F6wL4uhJZNkjDVKC9yx3lMKcAI65MhWk9iw95mDgY4tsWOVxQHGo9fRSn4cQ/FViknFtGBKuN8Arqgqy82Avi0HPxOBOWVhyep3U98rMNCueCQtChbvzqRd9HXd1BJjMtA7I/uvIzgJnWkZdFg7tMKBZBSaUolzpOJ9m+yKHppywjB/vY0CFpk9Aw4bz6xX384eQDl4MA0K18yMtSlb+cc9uDprJXbG7kvl2xGBYapYZbMHOwGPAJqaqOyGPMz8D3ap5zHC09bxmgG9irnaVj0PwyENKSY2Uizh7QSiNuySqtTkSmX1sOQKaMZuLlyaBFT65hN9IALzBKcL8PNh/M+S+94tJx020C3NssDKgSlv37hGQ50HLlR9zQGTpZ3m71U1GZEjTCxHJG7bX77Fgy7nbVTcR9uf7csaTm9eRC57JUSijQi1RBps5rrF/uSNBn/eDlzNgYQoonhoyfQCk3PadPiJa4fuDn1hiCR1Tw1HmBKIuzi/yWexJARvGHc4okisRcGCWbTxZMVLuoeBkvX5qbI5NFp0YXpTMrU1m9Zi0RCo/EQCrIW7iE4pj+8VYpI/lH4BY8lAIOwQetm+1Csq8/K4iyuPwhn8jfq5QP5GOwV8ZyBoML4GFI6jjvhW+eYBUEsZ2BLpvD6n8HgHOYtDNEKb1gS9Cy/zzPPFWcux9jzU7Krx1kSseZDXOAyu6UKPT6BpHpF5kBE42v4IKwrKtOMpeW90Ozko8ky1f0D3Rihw8MT9NbJEp+juL2JYqRfGHUD2VYIf4ukxi6a3Y5xIhNSCwF30hAVUBzfRCbC23W4+0RD274rC9RlY0j7SRDqk9PfRYO336BiegGLC68bBTb0Obr0OpnTpmmw1CDJB/yid/cs2xTclrHw8OwFiSL7oqp+Zb7LwqwiJK1AGF82UPLlrRUCBrBDtDWqIDOPIb52WjLsc60qs=", "X-Forefront-Antispam-Report": "CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:;\n IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com;\n PTR:InfoDomainNonexistent; CAT:NONE;\n SFS:(13230040)(376014)(1800799024)(36860700013)(35042699022)(14060799003)(82310400026)(13003099007);\n DIR:OUT; SFP:1101;", "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1", "X-MS-Exchange-AntiSpam-MessageData-0": "\n 4AFizoBJU8Y1Nd3LJnYUyrzx5+VmzBNo/o8TQfuFRte8PwU4qMOfHtM9LOv1RPSg2/au10NxjZJBMibYa2yPrbLy9qFvp2UgsGWwDyCPuMB6enZ7Iq2PP9vjf8skv6ABjGFvmuLwrwbQ+u0ILIDoBQDm5AUDE0EgfsXYLz0LO48OVg/bWFEKi5PdQeNvqtSBe5pkUSwiStXSbufWO1OodVm9Xzavd8jXDZScGdtBI500og0bOJpIh/bGBCJDjWga2P1kAmfC6g6VO0vbFg+i425yOtfHBOoXfZtw9bkVnuRY6WeRg46bFyHf3gpzpT7xyvjMHuuMq3t42Mya1CDEfjr/Dcwe+9KX39PI/LFcSSejhtn6eDBYLclObJiD1kVIxCleSBFZkSYB3qJrDQtNb6waxsLUbDgB6t46eOW1U/Tr646b/it/2ABd1sK9AWrK", "X-OriginatorOrg": "arm.com", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "10 Feb 2026 15:34:22.4464 (UTC)", "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n c4eb3317-a3a1-4d92-8160-08de68b9dd61", "X-MS-Exchange-CrossTenant-Id": "f34e5979-57d9-4aaa-ad4d-b122a662184d", "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129];\n Helo=[outbound-uk1.az.dlp.m.darktrace.com]", "X-MS-Exchange-CrossTenant-AuthSource": "\n AM2PEPF0001C70B.eurprd05.prod.outlook.com", "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous", "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "Commit 0547dbb725b reduced the number of cases in which\n union padding bits are zeroed when the relevant language\n standard does not strictly require it, unless gcc was\n invoked with -fzero-init-padding-bits=unions or\n -fzero-init-padding-bits=all in order to explicitly\n request zeroing of padding bits.\n\n This commit adds a closely related warning,\n -Wzero-init-padding-bits=, which is intended to help\n programmers to find code that might now need to be\n rewritten or recompiled with\n -fzero-init-padding-bits=unions or\n -fzero-init-padding-bits=all in order to replicate\n the behaviour that it had when compiled by older\n versions of GCC. It can also be used to find struct\n padding that was never previously guaranteed to be\n zero initialized and still isn't unless GCC is\n invoked with -fzero-init-padding-bits=all.\n\n The new warning can be set to the same three states\n as -fzero-init-padding-bits ('standard', 'unions'\n or 'all') and has the same default value ('standard').\n\n The two options interact as follows:\n\n f: standard f: unions f: all\n w: standard X X X\n w: unions U X X\n w: all A S X\n\n X = No warnings about padding\n U = Warnings about padding of unions.\n S = Warnings about padding of structs.\n A = Warnings about padding of structs and unions.\n\n The level of optimisation and whether or not the\n entire initializer is dropped to memory can both\n affect whether warnings are produced when compiling\n a given program. This is intentional, since tying\n the warnings more closely to the relevant language\n standard would require a very different approach\n that would still be target-dependent, might impose\n an unacceptable burden on programmers, and would\n risk not satisfying the intended use-case (which\n is closely tied to a specific optimisation).\n\ngcc/ChangeLog:\n\n\t* common.opt: Add Wzero-init-padding-bits=.\n\t* doc/invoke.texi: Document Wzero-init-padding-bits=.\n\t* expr.cc (categorize_ctor_elements_1): Update new struct type\n\tctor_completeness instead of an integer to indicate presence of\n\tpadding or missing fields in a constructor. Instead of setting -1\n\tupon discovery of padding bits in both structs and unions,\n\tset separate flags to indicate the type of padding bits.\n\t(categorize_ctor_elements): Update the type and documentation of\n\tthe p_complete parameter.\n\t(mostly_zeros_p): Use new struct type ctor_completeness when\n\tcalling categorize_ctor_elements.\n\t(all_zeros_p): Use new struct type ctor_completeness when\n calling categorize_ctor_elements.\n\t* expr.h (struct ctor_completeness): New struct type to replace an\n\tan integer that could take the value -1 ('all fields are\n\tinitialized, but there's padding'), 0 ('fields are missing') or\n\t1 ('all fields are initialized, and there's no padding'). Named\n\tbool members make the code easier to understand and make room to\n\tdisambiguate struct padding bits from union padding bits.\n\t(categorize_ctor_elements): Update the function declaration to use\n\tthe new struct type in the last parameter declaration.\n\t* gimplify.cc (gimplify_init_constructor): Replace use of\n\tcomplete_p != 0 ('all fields are initialized') with !sparse,\n\treplace use of complete == 0 ('fields are missing') with sparse, and\n\treplace use of complete <= 0 ('fields are missing' or 'all fields are\n\tinitialized, but there's padding') with sparse || padded_union or\n\tpadded_non_union. Trigger new warnings if storage for the object\n\tis not zeroed but padded_union or padded_non_union is set\n\t(because this combination implies possible non-zero padding bits).\n\ngcc/testsuite/ChangeLog:\n\n* gcc.dg/c23-empty-init-warn-1.c: New test.\n\t* gcc.dg/c23-empty-init-warn-10.c: New test.\n\t* gcc.dg/c23-empty-init-warn-11.c: New test.\n\t* gcc.dg/c23-empty-init-warn-12.c: New test.\n\t* gcc.dg/c23-empty-init-warn-13.c: New test.\n\t* gcc.dg/c23-empty-init-warn-14.c: New test.\n\t* gcc.dg/c23-empty-init-warn-15.c: New test.\n\t* gcc.dg/c23-empty-init-warn-16.c: New test.\n\t* gcc.dg/c23-empty-init-warn-17.c: New test.\n\t* gcc.dg/c23-empty-init-warn-2.c: New test.\n\t* gcc.dg/c23-empty-init-warn-3.c: New test.\n\t* gcc.dg/c23-empty-init-warn-4.c: New test.\n\t* gcc.dg/c23-empty-init-warn-5.c: New test.\n\t* gcc.dg/c23-empty-init-warn-6.c: New test.\n\t* gcc.dg/c23-empty-init-warn-7.c: New test.\n\t* gcc.dg/c23-empty-init-warn-8.c: New test.\n\t* gcc.dg/c23-empty-init-warn-9.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-1.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-10.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-11.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-12.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-13.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-14.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-15.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-16.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-17.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-2.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-3.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-4.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-5.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-6.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-7.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-8.c: New test.\n\t* gcc.dg/gnu11-empty-init-warn-9.c: New test.\n---\n gcc/common.opt | 4 +\n gcc/doc/invoke.texi | 83 +++++++++++++++++++\n gcc/expr.cc | 37 ++++-----\n gcc/expr.h | 20 ++++-\n gcc/gimplify.cc | 27 +++++-\n gcc/testsuite/gcc.dg/c23-empty-init-warn-1.c | 68 +++++++++++++++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-10.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-11.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-12.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-13.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-14.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-15.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-16.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-17.c | 51 ++++++++++++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-2.c | 69 +++++++++++++++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-3.c | 7 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-4.c | 69 +++++++++++++++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-5.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-6.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-7.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-8.c | 8 ++\n gcc/testsuite/gcc.dg/c23-empty-init-warn-9.c | 69 +++++++++++++++\n .../gcc.dg/gnu11-empty-init-warn-1.c | 52 ++++++++++++\n .../gcc.dg/gnu11-empty-init-warn-10.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-11.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-12.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-13.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-14.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-15.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-16.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-17.c | 51 ++++++++++++\n .../gcc.dg/gnu11-empty-init-warn-2.c | 59 +++++++++++++\n .../gcc.dg/gnu11-empty-init-warn-3.c | 7 ++\n .../gcc.dg/gnu11-empty-init-warn-4.c | 63 ++++++++++++++\n .../gcc.dg/gnu11-empty-init-warn-5.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-6.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-7.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-8.c | 8 ++\n .../gcc.dg/gnu11-empty-init-warn-9.c | 55 ++++++++++++\n 39 files changed, 943 insertions(+), 24 deletions(-)\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-1.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-10.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-11.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-12.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-13.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-14.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-15.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-16.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-17.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-2.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-3.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-4.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-5.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-6.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-7.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-8.c\n create mode 100644 gcc/testsuite/gcc.dg/c23-empty-init-warn-9.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-1.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-10.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-11.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-12.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-13.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-14.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-15.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-16.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-17.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-2.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-3.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-4.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-5.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-6.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-7.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-8.c\n create mode 100644 gcc/testsuite/gcc.dg/gnu11-empty-init-warn-9.c", "diff": "diff --git a/gcc/common.opt b/gcc/common.opt\nindex 88b79bbf8f5..0443c236172 100644\n--- a/gcc/common.opt\n+++ b/gcc/common.opt\n@@ -929,6 +929,10 @@ Wtsan\n Common Var(warn_tsan) Init(1) Warning\n Warn about unsupported features in ThreadSanitizer.\n \n+Wzero-init-padding-bits=\n+Common Joined RejectNegative Enum(zero_init_padding_bits_kind) Var(warn_zero_init_padding_bits) Init(ZERO_INIT_PADDING_BITS_STANDARD) Warning\n+-Wzero-init-padding-bits=[standard|unions|all]\tWarn about initializers that might not zero padding bits.\n+\n Xassembler\n Driver Separate\n \ndiff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi\nindex 60d0b570710..7a58ecac6c3 100644\n--- a/gcc/doc/invoke.texi\n+++ b/gcc/doc/invoke.texi\n@@ -476,6 +476,7 @@ Objective-C and Objective-C++ Dialects}.\n -Wno-xor-used-as-pow\n -Wzero-as-null-pointer-constant\n -Wzero-length-bounds\n+-Wzero-init-padding-bits=@var{value}\n --all-warnings --extra-warnings --no-warnings\n --pedantic --pedantic-errors}\n \n@@ -11526,6 +11527,88 @@ Suppress warnings when a positional initializer is used to initialize\n a structure that has been marked with the @code{designated_init}\n attribute.\n \n+@opindex Wzero-init-padding-bits=\n+@item -Wzero-init-padding-bits=@var{value}\n+Warn about automatic variable initializers that might not zero\n+initialize padding bits.\n+\n+Certain languages guarantee zero initialization of padding bits in\n+certain cases. The @code{-fzero-init-padding-bits=unions} and\n+@code{-fzero-init-padding-bits=all} options provide additional\n+guarantees that padding bits will be zero initialized in other\n+circumstances.\n+\n+This warning is mainly intended to find source code that might need to\n+be modified or else recompiled with\n+@code{-fzero-init-padding-bits=unions} or\n+@code{-fzero-init-padding-bits=all} in order to retain the behavior\n+that it had when compiled by versions of GCC older than 15.1. It can\n+also be used to find code that might result in uninitialized struct\n+padding unless GCC is invoked with @code{-fzero-init-padding-bits=all}\n+(regardless of the fact that older versions of GCC would not have\n+guaranteed initialization of struct padding either).\n+\n+It does not follow that all source code which causes warnings about\n+uninitialized padding bits has undefined behavior: usually, the values\n+of padding bits have no effect on execution of a program.\n+\n+The two options interact as follows:\n+\n+@multitable @columnfractions 0.25 0.25 0.25 0.25\n+@headitem @tab f:standard @tab f:unions @tab f:all\n+@item W:standard @tab X @tab X @tab X\n+@item W:unions @tab U @tab X @tab X\n+@item W:all @tab A @tab S @tab X\n+@end multitable\n+\n+@multitable @columnfractions .10 .90\n+@headitem Letter @tab Meaning\n+@item X @tab No warnings about padding bits.\n+@item U @tab Warnings about padding bits of unions.\n+@item S @tab Warnings about padding bits of structs.\n+@item A @tab Warnings about padding bits of structs and unions.\n+@end multitable\n+\n+Examples of union initialization for ISO C23 with\n+@code{-fzero-init-padding-bits=standard} and\n+@code{-Wzero-init-padding-bits=unions}:\n+\n+@smallexample\n+ long long q;\n+ unsigned char r;\n+ union U @{ unsigned char a; long long b; @};\n+ struct F @{ long long a; union U b; @};\n+\n+ // Padding bits are explicitly initialized\n+ union U h = @{@};\n+\n+ // Padding bits might not be initialized\n+ union U i = @{ r @};\n+\n+ // Padding bits might not be initialized\n+ union U j = @{ .a = r @};\n+\n+ // Union is expected to have no padding bits\n+ union U k = @{ .b = q @};\n+\n+ // Padding bits (of union) are explicitly initialized\n+ struct F l = @{ q, @{@}, .b.a = r @};\n+\n+ // Padding bits (of union) might not be initialized\n+ struct F m = @{ q, @{@}, .b = @{.a = r@} @};\n+@end smallexample\n+\n+In the declaration of @code{m}, an empty initializer that would otherwise\n+guarantee zero initialization of the padding bits of the union (i.e., storage\n+allocated for member @code{b} that is not part of member @code{a}) is\n+overridden by a subsequently listed initializer. This is an anti-pattern.\n+\n+Whether or not a given initializer causes a warning to be produced can be\n+predicted for simple cases but in general it is target-dependent because the\n+layout of storage is target-dependent. The level of optimization, size, and\n+initial value of the object being initialized also affect whether warnings are\n+produced.\n+\n @end table\n \n @node Static Analyzer Options\ndiff --git a/gcc/expr.cc b/gcc/expr.cc\nindex 4d1a6f3dd1c..246561300d3 100644\n--- a/gcc/expr.cc\n+++ b/gcc/expr.cc\n@@ -7133,7 +7133,8 @@ count_type_elements (const_tree type, bool for_ctor_p)\n static bool\n categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts,\n \t\t\t HOST_WIDE_INT *p_unique_nz_elts,\n-\t\t\t HOST_WIDE_INT *p_init_elts, int *p_complete)\n+\t\t\t HOST_WIDE_INT *p_init_elts,\n+\t\t\t ctor_completeness *p_complete)\n {\n unsigned HOST_WIDE_INT idx;\n HOST_WIDE_INT nz_elts, unique_nz_elts, init_elts, num_fields;\n@@ -7260,34 +7261,34 @@ categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts,\n \t}\n }\n \n- if (*p_complete && !complete_ctor_at_level_p (TREE_TYPE (ctor),\n+ if (!p_complete->sparse && !complete_ctor_at_level_p (TREE_TYPE (ctor),\n \t\t\t\t\t\tnum_fields, elt_type))\n- *p_complete = 0;\n+ p_complete->sparse = true;\n else if (TREE_CODE (TREE_TYPE (ctor)) == UNION_TYPE\n \t || TREE_CODE (TREE_TYPE (ctor)) == QUAL_UNION_TYPE)\n {\n- if (*p_complete\n+ if (!p_complete->sparse\n \t && CONSTRUCTOR_ZERO_PADDING_BITS (ctor)\n \t && (num_fields\n \t ? simple_cst_equal (TYPE_SIZE (TREE_TYPE (ctor)),\n \t\t\t\t TYPE_SIZE (elt_type)) != 1\n \t : type_has_padding_at_level_p (TREE_TYPE (ctor))))\n-\t*p_complete = 0;\n- else if (*p_complete > 0\n+\tp_complete->sparse = true;\n+ else if (!p_complete->sparse && !p_complete->padded_union\n \t && (num_fields\n \t\t ? simple_cst_equal (TYPE_SIZE (TREE_TYPE (ctor)),\n \t\t\t\t TYPE_SIZE (elt_type)) != 1\n \t\t : type_has_padding_at_level_p (TREE_TYPE (ctor))))\n-\t*p_complete = -1;\n+\tp_complete->padded_union = true;\n }\n- else if (*p_complete\n+ else if (!p_complete->sparse\n \t && (CONSTRUCTOR_ZERO_PADDING_BITS (ctor)\n \t || flag_zero_init_padding_bits == ZERO_INIT_PADDING_BITS_ALL)\n \t && type_has_padding_at_level_p (TREE_TYPE (ctor)))\n- *p_complete = 0;\n- else if (*p_complete > 0\n+ p_complete->sparse = true;\n+ else if (!p_complete->sparse && !p_complete->padded_non_union\n \t && type_has_padding_at_level_p (TREE_TYPE (ctor)))\n- *p_complete = -1;\n+ p_complete->padded_non_union = true;\n \n *p_nz_elts += nz_elts;\n *p_unique_nz_elts += unique_nz_elts;\n@@ -7309,9 +7310,6 @@ categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts,\n * whether the constructor is complete -- in the sense that every\n meaningful byte is explicitly given a value --\n and place it in *P_COMPLETE:\n- - 0 if any field is missing\n- - 1 if all fields are initialized, and there's no padding\n- - -1 if all fields are initialized, but there's padding\n \n Return whether or not CTOR is a valid static constant initializer, the same\n as \"initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0\". */\n@@ -7319,12 +7317,13 @@ categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts,\n bool\n categorize_ctor_elements (const_tree ctor, HOST_WIDE_INT *p_nz_elts,\n \t\t\t HOST_WIDE_INT *p_unique_nz_elts,\n-\t\t\t HOST_WIDE_INT *p_init_elts, int *p_complete)\n+\t\t\t HOST_WIDE_INT *p_init_elts,\n+\t\t\t ctor_completeness *p_complete)\n {\n *p_nz_elts = 0;\n *p_unique_nz_elts = 0;\n *p_init_elts = 0;\n- *p_complete = 1;\n+ *p_complete = {};\n \n return categorize_ctor_elements_1 (ctor, p_nz_elts, p_unique_nz_elts,\n \t\t\t\t p_init_elts, p_complete);\n@@ -7398,11 +7397,11 @@ mostly_zeros_p (const_tree exp)\n if (TREE_CODE (exp) == CONSTRUCTOR)\n {\n HOST_WIDE_INT nz_elts, unz_elts, init_elts;\n- int complete_p;\n+ ctor_completeness complete_p;\n \n categorize_ctor_elements (exp, &nz_elts, &unz_elts, &init_elts,\n \t\t\t\t&complete_p);\n- return !complete_p || nz_elts < init_elts / 4;\n+ return complete_p.sparse || nz_elts < init_elts / 4;\n }\n \n return initializer_zerop (exp);\n@@ -7416,7 +7415,7 @@ all_zeros_p (const_tree exp)\n if (TREE_CODE (exp) == CONSTRUCTOR)\n {\n HOST_WIDE_INT nz_elts, unz_elts, init_elts;\n- int complete_p;\n+ ctor_completeness complete_p;\n \n categorize_ctor_elements (exp, &nz_elts, &unz_elts, &init_elts,\n \t\t\t\t&complete_p);\ndiff --git a/gcc/expr.h b/gcc/expr.h\nindex ddd47cb4ecc..ee3ea60a8bd 100644\n--- a/gcc/expr.h\n+++ b/gcc/expr.h\n@@ -359,9 +359,27 @@ extern bool can_move_by_pieces (unsigned HOST_WIDE_INT, unsigned int);\n \n extern unsigned HOST_WIDE_INT highest_pow2_factor (const_tree);\n \n+struct ctor_completeness\n+{\n+ /* True if the type being constructed has padding that definitely needs to be\n+ zero-initialized, or some element of the constructor does not have a\n+ complete initializer, or both. */\n+ bool sparse : 1;\n+ /* True if the type being constructed is padded (or contains elements that are\n+ padded), that padding is not part of a union, and the constructor had not\n+ yet been categorized as sparse when all of this was discovered.\n+ */\n+ bool padded_non_union : 1;\n+ /* True if the type being constructed is padded (or contains elements that are\n+ padded), that padding is part of a union, and the constructor had not yet\n+ been categorized as sparse when all of this was discovered.\n+ */\n+ bool padded_union : 1;\n+};\n+\n extern bool categorize_ctor_elements (const_tree, HOST_WIDE_INT *,\n \t\t\t\t HOST_WIDE_INT *, HOST_WIDE_INT *,\n-\t\t\t\t int *);\n+\t\t\t\t ctor_completeness *);\n extern bool type_has_padding_at_level_p (tree);\n extern bool immediate_const_ctor_p (const_tree, unsigned int words = 1);\n extern void store_constructor (tree, rtx, int, poly_int64, bool);\ndiff --git a/gcc/gimplify.cc b/gcc/gimplify.cc\nindex a27dc46d88c..45b5d91f21c 100644\n--- a/gcc/gimplify.cc\n+++ b/gcc/gimplify.cc\n@@ -6460,7 +6460,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,\n \tstruct gimplify_init_ctor_preeval_data preeval_data;\n \tHOST_WIDE_INT num_ctor_elements, num_nonzero_elements;\n \tHOST_WIDE_INT num_unique_nonzero_elements;\n-\tint complete_p;\n+\tctor_completeness complete_p;\n \tbool valid_const_initializer;\n \n \t/* Aggregate types must lower constructors to initialization of\n@@ -6545,7 +6545,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,\n \t objects. Initializers for such objects must explicitly set\n \t every field that needs to be set. */\n \t cleared = false;\n-\telse if (!complete_p)\n+\telse if (complete_p.sparse)\n \t /* If the constructor isn't complete, clear the whole object\n \t beforehand, unless CONSTRUCTOR_NO_CLEARING is set on it.\n \n@@ -6570,7 +6570,8 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,\n \t That will avoid wasting cycles preserving any padding bits\n \t that might be there, and if there aren't any, the compiler\n \t is smart enough to optimize the clearing out. */\n-\telse if (complete_p <= 0\n+\telse if ((complete_p.sparse || complete_p.padded_union\n+\t\t || complete_p.padded_non_union)\n \t\t && !TREE_ADDRESSABLE (ctor)\n \t\t && !TREE_THIS_VOLATILE (object)\n \t\t && (TYPE_MODE (type) != BLKmode || TYPE_NO_FORCE_BLK (type))\n@@ -6589,7 +6590,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,\n \t clearing), and don't try to make bitwise copies of\n \t TREE_ADDRESSABLE types. */\n \tif (valid_const_initializer\n-\t && complete_p\n+\t && !complete_p.sparse\n \t && !(cleared || num_nonzero_elements == 0)\n \t && !TREE_ADDRESSABLE (type))\n \t {\n@@ -6644,6 +6645,24 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,\n \t }\n \t }\n \n+\tif (!cleared)\n+\t {\n+\t if (complete_p.padded_non_union\n+\t\t&& warn_zero_init_padding_bits >= ZERO_INIT_PADDING_BITS_ALL)\n+\t\twarning (OPT_Wzero_init_padding_bits_,\n+\t\t\t \"padding might not be initialized to zero; \"\n+\t\t\t \"if code relies on it being zero, consider \"\n+\t\t\t \"using %<-fzero-init-padding-bits=all%>\");\n+\t else if (complete_p.padded_union\n+\t\t && warn_zero_init_padding_bits\n+\t\t\t>= ZERO_INIT_PADDING_BITS_UNIONS)\n+\t\twarning (OPT_Wzero_init_padding_bits_,\n+\t\t\t \"padding might not be initialized to zero; \"\n+\t\t\t \"if code relies on it being zero, consider \"\n+\t\t\t \"using %<-fzero-init-padding-bits=unions%> \"\n+\t\t\t \"or %<-fzero-init-padding-bits=all%>\");\n+\t }\n+\n \t/* If a single access to the target must be ensured and there are\n \t nonzero elements or the zero elements are not assigned en masse,\n \t initialize the target from a temporary. */\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-1.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-1.c\nnew file mode 100644\nindex 00000000000..c82c4d66e4c\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-1.c\n@@ -0,0 +1,68 @@\n+/* Test that C23 warnings are produced about initializers that might\n+ * not zero padding bits of structs or unions. Expected results are different\n+ * from GNU11 because empty initializers zero padding bits.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=c23 -Wzero-init-padding-bits=all\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main (int argc, char *argv[])\n+{\n+ struct A a = {}; /* ZI because it omits a, b */\n+ struct B b = {}; /* ZI because it omits a, b, c */\n+ struct B c = { argc, 2 }; /* ZI because it omits c[0], c[1], c[2] */\n+\n+ /* ZI because it omits c[0], c[1] */\n+ struct B d = { .b = argc, .a = 2, .c[2].a = 3, .c[2].b = 4 }; \n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c[0] and c[2] as contagious */\n+ struct B e = { argc, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c as contagious */\n+ struct B f = { argc, 2, {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ struct B g = { argc, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6, /* { dg-warning \"padding might not be initialized to zero\" } */\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ union U h = {}; /* ZI because it omits a, b */\n+ union U i = { argc }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ union U j = { .a = argc }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ union U k = { .b = argc }; /* Largest member is initialized */\n+ struct D l = {}; /* ZI because it omits a, b, c */\n+ struct D m = { argc, 2 }; /* ZI because it omits c */\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c as contagious */\n+ struct D n = { argc, 2, {}, .c.a.a = 3, .c.a.b = 4 };\n+\n+ struct C o = { {} }; /* ZI because it omits a.a, a.b */\n+\n+ /* All (struct) padding is explicitly initialized */\n+ struct C p = { {}, .a.a = argc, .a.b = 4 };\n+\n+ struct E q = { argc, 2 }; /* No padding */\n+ union V r = { argc }; /* No padding */\n+\n+ /* All (union) padding is explicitly initialized */\n+ struct F s = { argc, {}, .b.a = 2 };\n+\n+ /* Empty initializer is overridden and therefore ineffective */\n+ struct F t = { argc, {}, .b = {.a = 2} }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-10.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-10.c\nnew file mode 100644\nindex 00000000000..2424db8e632\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-10.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (despite being enabled for unions)\n+ * about initializers that might not zero padding bits (when configured to zero\n+ * only padding bits of unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=unions -fzero-init-padding-bits=unions\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-11.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-11.c\nnew file mode 100644\nindex 00000000000..f11664c3f12\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-11.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (when explicitly disabled) about\n+ * initializers that might not zero padding bits (when configured to zero\n+ * only padding bits of unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=standard -fzero-init-padding-bits=unions\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-12.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-12.c\nnew file mode 100644\nindex 00000000000..7971a667535\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-12.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (by default) about\n+ * initializers that might not zero padding bits (when configured to zero\n+ * only padding bits of unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=unions\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-13.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-13.c\nnew file mode 100644\nindex 00000000000..900694e2d20\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-13.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (despite being enabled for structs\n+ * and unions) about initializers that might not zero padding bits (when\n+ * configured to zero padding bits of structs and unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=all -fzero-init-padding-bits=all\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-14.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-14.c\nnew file mode 100644\nindex 00000000000..08b3ef39987\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-14.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (despite being enabled for unions)\n+ * about initializers that might not zero padding bits (when configured to zero\n+ * padding bits of structs and unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=unions -fzero-init-padding-bits=all\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-15.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-15.c\nnew file mode 100644\nindex 00000000000..dd51b1235b3\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-15.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (when explicitly disabled) about\n+ * initializers that might not zero padding bits (when configured to zero\n+ * padding bits of structs and unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=standard -fzero-init-padding-bits=all\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-16.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-16.c\nnew file mode 100644\nindex 00000000000..ff503f8fb70\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-16.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (by default) about\n+ * initializers that might not zero padding bits (when configured to zero\n+ * padding bits of structs and unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=all\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-17.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-17.c\nnew file mode 100644\nindex 00000000000..00df5bf82da\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-17.c\n@@ -0,0 +1,51 @@\n+/* Test that no C23 warnings are produced about initializers of objects with\n+ * static storage duration that might not have zeroed padding bits if they\n+ * instead had automatic storage duration.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=c23 -Wzero-init-padding-bits=all\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main ()\n+{\n+ static struct A a = {};\n+ static struct B b = {};\n+ static struct B c = { 1, 2 };\n+ static struct B d = { .b = 1, .a = 2, .c[2].a = 3, .c[2].b = 4 };\n+\n+ static struct B e = { 1, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {},\n+\t\t\t.c[0].a = 3, .c[0].b = 4, .c[1].a = 5,\n+\t\t\t.c[1].b = 6, .c[2].a = 7, .c[2].b = 8 };\n+\n+ static struct B f = { 1, 2, {},\n+\t\t\t.c[0].a = 3, .c[0].b = 4, .c[1].a = 5,\n+\t\t\t.c[1].b = 6, .c[2].a = 7, .c[2].b = 8 };\n+\n+ static struct B g = { 1, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5,\n+\t\t\t.c[1].b = 6, .c[2].a = 7, .c[2].b = 8 };\n+\n+ static union U h = {};\n+ static union U i = { 1 };\n+ static union U j = { .a = 1 };\n+ static union U k = { .b = 1 };\n+ static struct D l = {};\n+ static struct D m = { 1, 2 };\n+ static struct D n = { 1, 2, {}, .c.a.a = 3, .c.a.b = 4 };\n+ static struct C o = { {} };\n+ static struct C p = { {}, .a.a = 3, .a.b = 4 };\n+ static struct E q = { 1, 2 };\n+ static union V r = { 1 };\n+ static struct F s = { 1, {}, .b.a = 2 };\n+ static struct F t = { 1, {}, .b = {.a = 2} };\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-2.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-2.c\nnew file mode 100644\nindex 00000000000..05d236dd685\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-2.c\n@@ -0,0 +1,69 @@\n+/* Test that C23 warnings are only produced (when enabled for unions) about\n+ * initializers that might not zero padding bits of unions. Expected results are\n+ * different from GNU11 because empty initializers zero padding bits.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=c23 -Wzero-init-padding-bits=unions\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main (int argc, char *argv[])\n+{\n+ struct A a = {}; /* ZI because it omits a, b */\n+ struct B b = {}; /* ZI because it omits a, b, c */\n+ struct B c = { argc, 2 }; /* ZI because it omits c[0], c[1], c[2] */\n+\n+ /* ZI because it omits c[0], c[1] */\n+ struct B d = { .b = argc, .a = 2, .c[2].a = 3, .c[2].b = 4 };\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c[0] and c[2] as contagious */\n+ struct B e = { argc, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {}, \n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c as contagious */\n+ struct B f = { argc, 2, {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized */\n+ struct B g = { argc, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6, \n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ union U h = {}; /* ZI because it omits a, b */\n+ union U i = { argc }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ union U j = { .a = argc }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ union U k = { .b = argc }; /* Largest member is initialized */\n+ struct D l = {}; /* ZI because it omits a, b, c */\n+ struct D m = { argc, 2 }; /* ZI because it omits c */\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c as contagious */\n+ struct D n = { argc, 2, {}, .c.a.a = 3, .c.a.b = 4 };\n+\n+ struct C o = { {} }; /* ZI because it omits a.a, a.b */\n+\n+ /* All (struct) padding is explicitly initialized */\n+ struct C p = { {}, .a.a = argc, .a.b = 4 };\n+\n+ struct E q = { argc, 2 }; /* No padding */\n+ union V r = { argc }; /* No padding */\n+\n+ /* All (union) padding is explicitly initialized */\n+ struct F s = { argc, {}, .b.a = 2 };\n+\n+ /* Empty initializer is overridden and therefore ineffective */\n+ struct F t = { argc, {}, .b = {.a = 2} }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-3.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-3.c\nnew file mode 100644\nindex 00000000000..569bfb218ae\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-3.c\n@@ -0,0 +1,7 @@\n+/* Test that no C23 warnings are produced (when explicitly disabled) about\n+ * initializers that might not zero padding bits.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=standard\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-4.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-4.c\nnew file mode 100644\nindex 00000000000..fc4dedb3001\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-4.c\n@@ -0,0 +1,69 @@\n+/* Test that no C23 warnings are produced (by default) about initializers\n+ * that might not zero padding bits. Expected results are the same as GNU11\n+ * despite the fact that empty initializers zero padding bits.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=c23\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main (int argc, char *argv[])\n+{\n+ struct A a = {}; /* ZI because it omits a, b */\n+ struct B b = {}; /* ZI because it omits a, b, c */\n+ struct B c = { argc, 2 }; /* ZI because it omits c[0], c[1], c[2] */\n+\n+ /* ZI because it omits c[0], c[1] */\n+ struct B d = { .b = argc, .a = 2, .c[2].a = 3, .c[2].b = 4 };\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c[0] and c[2] as contagious */\n+ struct B e = { argc, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c as contagious */\n+ struct B f = { argc, 2, {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized */\n+ struct B g = { argc, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ union U h = {}; /* ZI because it omits a, b */\n+ union U i = { argc }; /* Padding bits might not be initialized */\n+ union U j = { .a = argc }; /* Padding bits might not be initialized */\n+ union U k = { .b = argc }; /* Largest member is initialized */\n+ struct D l = {}; /* ZI because it omits a, b, c */\n+ struct D m = { argc, 2 }; /* ZI because it omits c */\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c as contagious */\n+ struct D n = { argc, 2, {}, .c.a.a = 3, .c.a.b = 4 };\n+\n+ struct C o = { {} }; /* ZI because it omits a.a, a.b */\n+\n+ /* All (struct) padding is explicitly initialized */\n+ struct C p = { {}, .a.a = argc, .a.b = 4 };\n+\n+ struct E q = { argc, 2 }; /* No padding */\n+ union V r = { argc }; /* No padding */\n+\n+ /* All (union) padding is explicitly initialized */\n+ struct F s = { argc, {}, .b.a = 2 };\n+\n+ /* Empty initializer is overridden and therefore ineffective */\n+ struct F t = { argc, {}, .b = {.a = 2} };\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-5.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-5.c\nnew file mode 100644\nindex 00000000000..f9578eb1ee3\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-5.c\n@@ -0,0 +1,8 @@\n+/* Test that C23 warnings are produced about initializers that might\n+ * not zero padding bits of structs or unions (when configured not to zero\n+ * padding bits unless mandated by the language standard).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=standard\" } */\n+\n+#include \"c23-empty-init-warn-1.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-6.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-6.c\nnew file mode 100644\nindex 00000000000..395dc058c09\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-6.c\n@@ -0,0 +1,8 @@\n+/* Test that C23 warnings are only produced (when enabled for unions) about\n+ * initializers that might not zero padding bits of unions (when configured not\n+ * to zero padding bits unless mandated by the language standard).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=standard\" } */\n+\n+#include \"c23-empty-init-warn-2.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-7.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-7.c\nnew file mode 100644\nindex 00000000000..9d8cb8a0509\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-7.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (when explicitly disabled) about\n+ * initializers that might not zero padding bits (when configured not to zero\n+ * padding bits unless mandated by the language standard).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=standard -fzero-init-padding-bits=standard\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-8.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-8.c\nnew file mode 100644\nindex 00000000000..9a2e4dd33bd\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-8.c\n@@ -0,0 +1,8 @@\n+/* Test that no C23 warnings are produced (by default) about\n+ * initializers that might not zero padding bits (when configured not to zero\n+ * padding bits unless mandated by the language standard).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=standard\" } */\n+\n+#include \"c23-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/c23-empty-init-warn-9.c b/gcc/testsuite/gcc.dg/c23-empty-init-warn-9.c\nnew file mode 100644\nindex 00000000000..3208d85f579\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/c23-empty-init-warn-9.c\n@@ -0,0 +1,69 @@\n+/* Test that C23 warnings are only produced (when enabled for structs and\n+ * unions) about initializers that might not zero padding bits of structs (when\n+ * configured to only zero padding bits of unions). Expected results are\n+ * different from GNU11 because empty initializers zero padding bits.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=c23 -Wzero-init-padding-bits=all -fzero-init-padding-bits=unions\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main (int argc, char *argv[])\n+{\n+ struct A a = {}; /* ZI because it omits a, b */\n+ struct B b = {}; /* ZI because it omits a, b, c */\n+ struct B c = { argc, 2 }; /* ZI because it omits c[0], c[1], c[2] */\n+\n+ /* ZI because it omits c[0], c[1] */\n+ struct B d = { .b = argc, .a = 2, .c[2].a = 3, .c[2].b = 4 };\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c[0] and c[2] as contagious */\n+ struct B e = { argc, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c as contagious */\n+ struct B f = { argc, 2, {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ struct B g = { argc, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6, /* { dg-warning \"padding might not be initialized to zero\" } */\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ union U h = {}; /* ZI because it omits a, b */\n+ union U i = { argc }; /* Padding bits might not be initialized */\n+ union U j = { .a = argc }; /* Padding bits might not be initialized */\n+ union U k = { .b = argc }; /* Largest member is initialized */\n+ struct D l = {}; /* ZI because it omits a, b, c */\n+ struct D m = { argc, 2 }; /* ZI because it omits c */\n+\n+ /* Padding bits might not be initialized according to C23 but GCC treats\n+ the explicitly initialized padding of c as contagious */\n+ struct D n = { argc, 2, {}, .c.a.a = 3, .c.a.b = 4 };\n+\n+ struct C o = { {} }; /* ZI because it omits a.a, a.b */\n+\n+ /* All (struct) padding is explicitly initialized */\n+ struct C p = { {}, .a.a = argc, .a.b = 4 };\n+\n+ struct E q = { argc, 2 }; /* No padding */\n+ union V r = { argc }; /* No padding */\n+\n+ /* All (union) padding is explicitly initialized */\n+ struct F s = { argc, {}, .b.a = 2 };\n+\n+ /* Empty initializer is overridden and therefore ineffective */\n+ struct F t = { argc, {}, .b = {.a = 2} };\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-1.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-1.c\nnew file mode 100644\nindex 00000000000..ca7edf008fc\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-1.c\n@@ -0,0 +1,52 @@\n+/* Test that GNU11 warnings are produced about initializers that might\n+ * not zero padding bits of structs or unions.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=gnu11 -Wzero-init-padding-bits=all\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main (int argc, char *argv[])\n+{\n+ struct A a = {}; /* ZI because it omits a, b */\n+ struct B b = {}; /* ZI because it omits a, b, c */\n+ struct B c = { argc, 2 }; /* ZI because it omits c[0], c[1], c[2] */\n+\n+ /* ZI because it omits c[0], c[1] */\n+ struct B d = { .b = argc, .a = 2, .c[2].a = 3, .c[2].b = 4 };\n+\n+ struct B e = { argc, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {}, /* { dg-warning \"padding might not be initialized to zero\" } */\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ struct B f = { argc, 2, {}, /* { dg-warning \"padding might not be initialized to zero\" } */\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ struct B g = { argc, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6, /* { dg-warning \"padding might not be initialized to zero\" } */\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ union U h = {}; /* ZI because it omits a, b */\n+ union U i = { argc }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ union U j = { .a = argc }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ union U k = { .b = argc }; /* Largest member is initialized */\n+ struct D l = {}; /* ZI because it omits a, b, c */\n+ struct D m = { argc, 2 }; /* ZI because it omits c */\n+ struct D n = { argc, 2, {}, .c.a.a = 3, .c.a.b = 4 }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ struct C o = { {} }; /* ZI because it omits a.a, a.b */\n+ struct C p = { {}, .a.a = argc, .a.b = 4 }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ struct E q = { argc, 2 }; /* No padding */\n+ union V r = { argc }; /* No padding */\n+ struct F s = { argc, {}, .b.a = 2 }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ struct F t = { argc, {}, .b = {.a = 2} }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-10.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-10.c\nnew file mode 100644\nindex 00000000000..da15fd5e539\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-10.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (despite being enabled for unions)\n+ * about initializers that might not zero padding bits (when configured to zero\n+ * only padding bits of unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=unions -fzero-init-padding-bits=unions\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-11.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-11.c\nnew file mode 100644\nindex 00000000000..d900f212d6a\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-11.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (when explicitly disabled) about\n+ * initializers that might not zero padding bits (when configured to zero\n+ * only padding bits of unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=standard -fzero-init-padding-bits=unions\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-12.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-12.c\nnew file mode 100644\nindex 00000000000..072b144d3a0\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-12.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (by default) about\n+ * initializers that might not zero padding bits (when configured to zero\n+ * only padding bits of unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=unions\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-13.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-13.c\nnew file mode 100644\nindex 00000000000..03a690776f1\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-13.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (despite being enabled for structs\n+ * and unions) about initializers that might not zero padding bits (when\n+ * configured to zero padding bits of structs and unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=all -fzero-init-padding-bits=all\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-14.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-14.c\nnew file mode 100644\nindex 00000000000..4cf62a7dee5\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-14.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (despite being enabled for unions)\n+ * about initializers that might not zero padding bits (when configured to zero\n+ * padding bits of structs and unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=unions -fzero-init-padding-bits=all\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-15.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-15.c\nnew file mode 100644\nindex 00000000000..45ce183a757\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-15.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (when explicitly disabled) about\n+ * initializers that might not zero padding bits (when configured to zero\n+ * padding bits of structs and unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=standard -fzero-init-padding-bits=all\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-16.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-16.c\nnew file mode 100644\nindex 00000000000..23519cf8bc3\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-16.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (by default) about\n+ * initializers that might not zero padding bits (when configured to zero\n+ * padding bits of structs and unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=all\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-17.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-17.c\nnew file mode 100644\nindex 00000000000..d126844abab\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-17.c\n@@ -0,0 +1,51 @@\n+/* Test that no GNU11 warnings are produced about initializers of objects with\n+ * static storage duration that might not have zeroed padding bits if they\n+ * instead had automatic storage duration.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=gnu11 -Wzero-init-padding-bits=all\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main ()\n+{\n+ static struct A a = {};\n+ static struct B b = {};\n+ static struct B c = { 1, 2 };\n+ static struct B d = { .b = 1, .a = 2, .c[2].a = 3, .c[2].b = 4 };\n+\n+ static struct B e = { 1, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {},\n+ .c[0].a = 3, .c[0].b = 4, .c[1].a = 5,\n+ .c[1].b = 6, .c[2].a = 7, .c[2].b = 8 };\n+\n+ static struct B f = { 1, 2, {},\n+ .c[0].a = 3, .c[0].b = 4, .c[1].a = 5,\n+ .c[1].b = 6, .c[2].a = 7, .c[2].b = 8 };\n+\n+ static struct B g = { 1, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5,\n+ .c[1].b = 6, .c[2].a = 7, .c[2].b = 8 };\n+\n+ static union U h = {};\n+ static union U i = { 1 };\n+ static union U j = { .a = 1 };\n+ static union U k = { .b = 1 };\n+ static struct D l = {};\n+ static struct D m = { 1, 2 };\n+ static struct D n = { 1, 2, {}, .c.a.a = 3, .c.a.b = 4 };\n+ static struct C o = { {} };\n+ static struct C p = { {}, .a.a = 3, .a.b = 4 };\n+ static struct E q = { 1, 2 };\n+ static union V r = { 1 };\n+ static struct F s = { 1, {}, .b.a = 2 };\n+ static struct F t = { 1, {}, .b = {.a = 2} };\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-2.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-2.c\nnew file mode 100644\nindex 00000000000..4837208c2fe\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-2.c\n@@ -0,0 +1,59 @@\n+/* Test that GNU11 warnings are only produced (when enabled for unions) about\n+ * initializers that might not zero padding bits of unions.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=gnu11 -Wzero-init-padding-bits=unions\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main (int argc, char *argv[])\n+{\n+ struct A a = {}; /* ZI because it omits a, b */\n+ struct B b = {}; /* ZI because it omits a, b, c */\n+ struct B c = { argc, 2 }; /* ZI because it omits c[0], c[1], c[2] */\n+ struct B d = { .b = 1, .a = 2, .c[2].a = 3, .c[2].b = 4 }; /* ZI because it omits c[0], c[1] */\n+\n+ /* Padding bits might not be initialized */\n+ struct B e = { argc, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {}, \n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized */\n+ struct B f = { argc, 2, {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized */\n+ struct B g = { argc, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6, \n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ union U h = {}; /* ZI because it omits a, b */\n+ union U i = { argc }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ union U j = { .a = argc }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ union U k = { .b = argc }; /* Largest member is initialized */\n+ struct D l = {}; /* ZI because it omits a, b, c */\n+ struct D m = { argc, 2 }; /* ZI because it omits c */\n+\n+ /* Padding bits might not be initialized */\n+ struct D n = { argc, 2, {}, .c.a.a = 3, .c.a.b = 4 };\n+\n+ struct C o = { {} }; /* ZI because it omits a.a, a.b */\n+\n+ /* Padding bits might not be initialized */\n+ struct C p = { {}, .a.a = argc, .a.b = 4 };\n+\n+ struct E q = { argc, 2 }; /* No padding */\n+ union V r = { argc }; /* No padding */\n+ struct F s = { argc, {}, .b.a = 2 }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ struct F t = { argc, {}, .b = {.a = 2} }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-3.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-3.c\nnew file mode 100644\nindex 00000000000..499b3f84bb4\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-3.c\n@@ -0,0 +1,7 @@\n+/* Test that no GNU11 warnings are produced (when explicitly disabled) about\n+ * initializers that might not zero padding bits.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=standard\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-4.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-4.c\nnew file mode 100644\nindex 00000000000..6c693d914ed\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-4.c\n@@ -0,0 +1,63 @@\n+/* Test that no GNU11 warnings are produced (by default) about initializers\n+ * that might not zero padding bits.\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=gnu11\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main (int argc, char *argv[])\n+{\n+ struct A a = {}; /* ZI because it omits a, b */\n+ struct B b = {}; /* ZI because it omits a, b, c */\n+ struct B c = { argc, 2 }; /* ZI because it omits c[0], c[1], c[2] */\n+\n+ /* ZI because it omits c[0], c[1] */\n+ struct B d = { .b = argc, .a = 2, .c[2].a = 3, .c[2].b = 4 };\n+\n+ /* Padding bits might not be initialized */\n+ struct B e = { argc, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized */\n+ struct B f = { argc, 2, {},\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ /* Padding bits might not be initialized */\n+ struct B g = { argc, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ union U h = {}; /* ZI because it omits a, b */\n+ union U i = { argc }; /* Padding bits might not be initialized */\n+ union U j = { .a = argc }; /* Padding bits might not be initialized */\n+ union U k = { .b = argc }; /* Largest member is initialized */\n+ struct D l = {}; /* ZI because it omits a, b, c */\n+ struct D m = { argc, 2 }; /* ZI because it omits c */\n+\n+ /* Padding bits might not be initialized */\n+ struct D n = { argc, 2, {}, .c.a.a = 3, .c.a.b = 4 };\n+\n+ struct C o = { {} }; /* ZI because it omits a.a, a.b */\n+\n+ /* Padding bits might not be initialized */\n+ struct C p = { {}, .a.a = argc, .a.b = 4 };\n+\n+ struct E q = { argc, 2 }; /* No padding */\n+ union V r = { argc }; /* No padding */\n+\n+ /* Padding bits (of union) might not be initialized */\n+ struct F s = { argc, {}, .b.a = 2 };\n+ struct F t = { argc, {}, .b = {.a = 2} };\n+\n+ return 0;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-5.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-5.c\nnew file mode 100644\nindex 00000000000..f6e6e3537fc\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-5.c\n@@ -0,0 +1,8 @@\n+/* Test that GNU11 warnings are produced about initializers that might\n+ * not zero padding bits of structs or unions (when configured not to zero\n+ * padding bits unless mandated by the language standard).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=standard\" } */\n+\n+#include \"gnu11-empty-init-warn-1.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-6.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-6.c\nnew file mode 100644\nindex 00000000000..41f8f17059a\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-6.c\n@@ -0,0 +1,8 @@\n+/* Test that GNU11 warnings are only produced (when enabled for unions) about\n+ * initializers that might not zero padding bits of unions (when configured not\n+ * to zero padding bits unless mandated by the language standard).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=standard\" } */\n+\n+#include \"gnu11-empty-init-warn-2.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-7.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-7.c\nnew file mode 100644\nindex 00000000000..6cfa310f5ac\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-7.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (when explicitly disabled) about\n+ * initializers that might not zero padding bits (when configured not to zero\n+ * padding bits unless mandated by the language standard).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-Wzero-init-padding-bits=standard -fzero-init-padding-bits=standard\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-8.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-8.c\nnew file mode 100644\nindex 00000000000..57cc58d89f2\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-8.c\n@@ -0,0 +1,8 @@\n+/* Test that no GNU11 warnings are produced (by default) about\n+ * initializers that might not zero padding bits (when configured not to zero\n+ * padding bits unless mandated by the language standard).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-fzero-init-padding-bits=standard\" } */\n+\n+#include \"gnu11-empty-init-warn-4.c\"\ndiff --git a/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-9.c b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-9.c\nnew file mode 100644\nindex 00000000000..d9f4d9a431a\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/gnu11-empty-init-warn-9.c\n@@ -0,0 +1,55 @@\n+/* Test that GNU11 warnings are only produced (when enabled for structs and\n+ * unions) about initializers that might not zero padding bits of structs (when\n+ * configured to only zero padding bits of unions).\n+ */\n+/* { dg-do run } */\n+/* { dg-options \"-std=gnu11 -Wzero-init-padding-bits=all -fzero-init-padding-bits=unions\" } */\n+\n+struct A { unsigned char a; long long b; };\n+struct B { unsigned char a; long long b; struct A c[3]; };\n+struct C { struct A a; };\n+struct D { unsigned char a; long long b; struct C c; };\n+struct E { long long a; long long b; };\n+union U { unsigned char a; long long b; };\n+union V { long long a; long long b; };\n+struct F { long long a; union U b; };\n+\n+int\n+main (int argc, char *argv[])\n+{\n+ struct A a = {}; /* ZI because it omits a, b */\n+ struct B b = {}; /* ZI because it omits a, b, c */\n+ struct B c = { argc, 2 }; /* ZI because it omits c[0], c[1], c[2] */\n+\n+ /* ZI because it omits c[0], c[1] */\n+ struct B d = { .b = argc, .a = 2, .c[2].a = 3, .c[2].b = 4 };\n+\n+ struct B e = { argc, 2, .c[2] = {}, .c[1] = { 9 }, .c[0] = {}, /* { dg-warning \"padding might not be initialized to zero\" } */\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ struct B f = { argc, 2, {}, /* { dg-warning \"padding might not be initialized to zero\" } */\n+\t\t .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6,\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ struct B g = { argc, 2, .c[0].a = 3, .c[0].b = 4, .c[1].a = 5, .c[1].b = 6, /* { dg-warning \"padding might not be initialized to zero\" } */\n+\t\t .c[2].a = 7, .c[2].b = 8 };\n+\n+ union U h = {}; /* ZI because it omits a, b */\n+ union U i = { argc }; /* Padding bits might not be initialized */\n+ union U j = { .a = argc }; /* Padding bits might not be initialized */\n+ union U k = { .b = argc }; /* Largest member is initialized */\n+ struct D l = {}; /* ZI because it omits a, b, c */\n+ struct D m = { argc, 2 }; /* ZI because it omits c */\n+ struct D n = { argc, 2, {}, .c.a.a = 3, .c.a.b = 4 }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ struct C o = { {} }; /* ZI because it omits a.a, a.b */\n+ struct C p = { {}, .a.a = argc, .a.b = 4 }; /* { dg-warning \"padding might not be initialized to zero\" } */\n+ struct E q = { argc, 2 }; /* No padding */\n+ union V r = { argc }; /* No padding */\n+\n+ /* Padding bits (of union) might not be initialized */\n+ struct F s = { argc, {}, .b.a = 2 };\n+ struct F t = { argc, {}, .b = {.a = 2} };\n+\n+ return 0;\n+}\n", "prefixes": [ "v5", "1/1" ] }