From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 966C3C4167B for ; Tue, 13 Dec 2022 08:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234304AbiLMIbm convert rfc822-to-8bit (ORCPT ); Tue, 13 Dec 2022 03:31:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234770AbiLMIbJ (ORCPT ); Tue, 13 Dec 2022 03:31:09 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5C21A80D for ; Tue, 13 Dec 2022 00:30:12 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-310-7JytmWPuMGiigtX7_hd_5g-1; Tue, 13 Dec 2022 08:30:09 +0000 X-MC-Unique: 7JytmWPuMGiigtX7_hd_5g-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 13 Dec 2022 08:30:08 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.044; Tue, 13 Dec 2022 08:30:08 +0000 From: David Laight To: 'Tejun Heo' , Jiri Slaby CC: Christoph Hellwig , "linux-kernel@vger.kernel.org" , Martin Liska , Josef Bacik , Jens Axboe , "cgroups@vger.kernel.org" , "linux-block@vger.kernel.org" Subject: RE: [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints Thread-Topic: [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints Thread-Index: AQHY7hGH734dfSyX20WOi86L/FtKtq4rTpIAgD+71dKAALHkcA== Date: Tue, 13 Dec 2022 08:30:08 +0000 Message-ID: References: <20221031114520.10518-1-jirislaby@kernel.org> <2b975ee3117e45aaa7882203cf9a4db8@AcuMS.aculab.com> <320c939e-a3f0-1b1e-77e4-f3ecca00465d@kernel.org> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tejun Heo On Behalf Of 'Tejun Heo' > Sent: 12 December 2022 21:47 > To: Jiri Slaby > Cc: David Laight ; Christoph Hellwig ; linux- > kernel@vger.kernel.org; Martin Liska ; Josef Bacik ; Jens Axboe > ; cgroups@vger.kernel.org; linux-block@vger.kernel.org > Subject: Re: [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints > > On Mon, Dec 12, 2022 at 01:14:31PM +0100, Jiri Slaby wrote: > > > If so, my suggestion is just sticking with the old behavior until we switch > > > to --std=g2x and then make one time adjustment at that point. > > > > So is the enum split OK under these circumstances? > > Oh man, it's kinda crazy that the compiler is changing in a way that the > same piece of code can't be compiled the same way across two adjoining > versions of the same compiler. But, yeah, if that's what gcc is gonna do and > splitting enums is the only way to be okay across the compiler versions, > there isn't any other choice we can make. It is also a silent code-breaker. Compile this for 32bit x86: enum { a = 1, b = ~0ull}; extern int foo(int, ...); int f(void) { return foo(0, a, 2); } gcc13 pushes an extra zero onto the stack between the 1 and 2. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)