From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jHIth-00081g-01 for mharc-grub-devel@gnu.org; Wed, 25 Mar 2020 23:09:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58080) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHIte-00080w-BM for grub-devel@gnu.org; Wed, 25 Mar 2020 23:09:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHItb-0007OJ-FG for grub-devel@gnu.org; Wed, 25 Mar 2020 23:09:28 -0400 Received: from m4a0073g.houston.softwaregrp.com ([15.124.2.131]:51353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jHItb-0007Kp-8K for grub-devel@gnu.org; Wed, 25 Mar 2020 23:09:27 -0400 Received: FROM m4a0073g.houston.softwaregrp.com (15.120.17.146) BY m4a0073g.houston.softwaregrp.com WITH ESMTP; Thu, 26 Mar 2020 03:06:53 +0000 Received: from M9W0068.microfocus.com (2002:f79:bf::f79:bf) by M4W0334.microfocus.com (2002:f78:1192::f78:1192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 26 Mar 2020 03:09:02 +0000 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (15.124.72.12) by M9W0068.microfocus.com (15.121.0.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Thu, 26 Mar 2020 03:09:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XpOPuzWiWo1vQeKkwzP8Xq94j96To3YXr1qOcG0v/nXBLGHQaW33eWiIce3BEAttH3Tm9lHwJDR9zQq16LZ1rt5oSr/kaYUOyjEG0udA9ssow1RqZRTibsXTJEnCwY+fu1OYtqgprWzk/abnFwUxCumvzK6xRAi9q62jMaU+gO1jnQ0TqBgUoHe2rvkP1m6Ff8j8j3YApFa0YcZEG6WCSledCLtu3uJfFqz7Zm63wTGty6jpadU2YIoYW0+l/k/0+7xLzX5GqurxLDXmqfuaW691ffMvVYMKK2J+u5fjTRUhRZqrljVAd0fa8+heKmt23aFwqUGNKcazIjauqauhRA== 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-SenderADCheck; bh=izKDFCWzzyi+a7y5WlfW6tqLQOZx9+W8BzI2J8vKLxQ=; b=mZhqxKuj21a7hTJ6ANtlklpKz3tjhz7TEhxNtBaNCUCmcFpMaS3y68cNgROi4zLQCU/R4KcHap3juv0fAGAt0SyamqpmJVcQVb343vY4NKFO8JOzAWnJYYVzA+I16r6DNemS2qLo9SvXQxTNHLuz8mo+JP0uRRdUaO60wdQStbpoQnQAj+p5LCoVrtkLUIF1+2CVqB08MROpMxRclSaZ3yPQwZRJQSzvV9ICl/jxsTSDdbBhrPpodvsBT1wxt/opE2zYEmN5cqfuFUJuS0iDDGY+8KVSuNqXvTKnO7X3KoVs3jrimoJCFd0gTA3mvOKER4TlTyfo4CegPeoDJdG9Uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=MChang@suse.com; Received: from BY5PR18MB3140.namprd18.prod.outlook.com (2603:10b6:a03:1a1::17) by BY5PR18MB3201.namprd18.prod.outlook.com (2603:10b6:a03:196::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Thu, 26 Mar 2020 03:09:01 +0000 Received: from BY5PR18MB3140.namprd18.prod.outlook.com ([fe80::a404:f256:fbe8:c2d]) by BY5PR18MB3140.namprd18.prod.outlook.com ([fe80::a404:f256:fbe8:c2d%4]) with mapi id 15.20.2856.019; Thu, 26 Mar 2020 03:09:01 +0000 Date: Thu, 26 Mar 2020 11:08:54 +0800 From: Michael Chang To: The development of GNU GRUB CC: Subject: Re: disk/mdraid1x_linux.c:181:15: warning: array subscript ... Message-ID: <20200326030854.GA4258@mercury> References: <20200325072728.GA13446@mercury> <6700719198161959727@scdbackup.webframe.org> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <6700719198161959727@scdbackup.webframe.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: SN4PR0701CA0020.namprd07.prod.outlook.com (2603:10b6:803:28::30) To BY5PR18MB3140.namprd18.prod.outlook.com (2603:10b6:a03:1a1::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mercury (36.226.146.226) by SN4PR0701CA0020.namprd07.prod.outlook.com (2603:10b6:803:28::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.21 via Frontend Transport; Thu, 26 Mar 2020 03:08:59 +0000 X-Originating-IP: [36.226.146.226] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1389eda6-f374-4c23-fd15-08d7d13307ce X-MS-TrafficTypeDiagnostic: BY5PR18MB3201: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-Forefront-PRVS: 0354B4BED2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4636009)(366004)(396003)(136003)(376002)(346002)(39860400002)(33716001)(4326008)(9686003)(86362001)(6916009)(5660300002)(966005)(8936002)(9576002)(81166006)(186003)(26005)(55016002)(16526019)(956004)(81156014)(8676002)(52116002)(6496006)(316002)(478600001)(1076003)(33656002)(66556008)(66946007)(66476007)(6666004)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY5PR18MB3201; H:BY5PR18MB3140.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: suse.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: htXbRgVb8KPYnTgUBLIKYXNJ8Cagx9xACqdAu69xntGANckEeyDvU1HYGltn0Tm4pRcYb7wd367p218w3t+16spfHw1ljHoqDMf3ywgI52A6BEDsDhWWbr5mrDKvTAISKD3L3H2POe5waJWarSshE/rNeJ2rVNNeR2u7VcWK2P4QhtUIPZNSJnGF6UG0eIrkLMjxGLw71IykrGLRI96MRqtkvV9HkN7kHXVhAp5OWuWzA54Y9/DFz2UiFwVopdRiTWOv8+Sv1YpRkmAPqCvHgfG+NTRh0x2oKgrJPnCpGIpIhPxNRn3vc5ycIJlJ7VObF72vthFx/WtLzNItxhgoBsdtSr8/PGskv8kHpjPVxPTrCZ/msuoj9o5egLXmjPYp0Fpb4Xx78KoM4r/HUWOyEPHPAbuIZoUGyZWd9vApnHreJoioprr9RFccJREBziKyanuEiqueLBVdTgyJdbNK9NUVvPbRMOMbXmY9pIaeI0FCCL5u2iv2J3OGW+SZ0JIkPqp2h0lHUB4U9SF3/aSexA== X-MS-Exchange-AntiSpam-MessageData: OQr0Iwq+V5a28WH/mkE5fYsqLXTHe9bAypgD21swuThSc/lWhLBSSFfNZzy8Wse6MuvuFy82bEoepOw8d9WAgirTBVM4sGIXk6yDCWMhXkSpxVKJyz8NUS1iXT6KfWYkGOTrVlY2PM4GIHKnlM6nvA== X-MS-Exchange-CrossTenant-Network-Message-Id: 1389eda6-f374-4c23-fd15-08d7d13307ce X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2020 03:09:01.1901 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VLCIttzloGCwV1w2Cgnw4aGWTh7jkRnK3Rsbo+72bH7FHXOwvWbfAH2kuYq9cSaR X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR18MB3201 X-OriginatorOrg: suse.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 15.124.2.131 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Mar 2020 03:09:31 -0000 On Wed, Mar 25, 2020 at 12:13:49PM +0100, Thomas Schmitt wrote: > Hi, > > Michael Chang wrote in patch 2/2: > > ../../grub-core/fs/zfs/zfs.c:2263:44: error: array subscript '' is > > outside the bounds of an interior zero-length array 'grub_uint16_t[0]' {aka > > 'short unsigned int[0]'} [-Werror=zero-length-bounds] > > [...] > > The l_hash[0] is apparnetly an interior member to the enclosed structure > > [...] the l_entries[0] is used to get proper alignment to access leaf chunks > > That's what i call a dirty hack. > > I wonder what gcc would say to a union of [0]-sized arrays as last > member of the struct type: > > struct typedef struct zap_leaf_phys { > ... > union { > grub_uint16_t l_hash[0]; > grub_properly_aligned_t l_entries[0]; > } l_; > } zap_leaf_phys_t; As far as I know the union will store different types in same memory location, thus the allocation is determined by the largest member in the union, so does the padding has to meet the alignment requirement by the largest member. So in this case l_hash[0] (2 bytes) will be aligned to grub_properly_aligned_t (8 bytes) and for the result is desired or not really depends on what you want to achieve. > > Mine likes such a gesture, but it is way behind in respect to modern bitrot. Admittedly that would produce much more readable code, but it is just not work for the extraordinary case here because of specific requirment to the alignment. > > > So in the end, your patch looks like the solid and unambiguous way to > implement what is desired. > > > > It would be great if you can help to test patch to solve the build > > problem for gcc-10 in your system or not. > > Due to lack of modernity i can only contribute statements that the > concepts and motivations of your two patches look good to me. > > (I also lack the occasion to test the two use cases. > Just lurking here for grub-mkrescue issues, where i provide the last stage > of packing up the ISO image.) The grub-mkrescue is a gem, it never disappoints me whenever I need it. :) Thanks a lot for your feedback. Michael > > > Have a nice day :) > > Thomas > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel