[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d26f03e828c94df5b4653ac6980def59@AcuMS.aculab.com>
Date: Tue, 13 Dec 2022 12:58:10 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Jiri Slaby' <jirislaby@...nel.org>, 'Tejun Heo' <tj@...nel.org>
CC: Christoph Hellwig <hch@...radead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Martin Liska <mliska@...e.cz>,
Josef Bacik <josef@...icpanda.com>,
Jens Axboe <axboe@...nel.dk>,
"cgroups@...r.kernel.org" <cgroups@...r.kernel.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>
Subject: RE: [PATCH] block/blk-iocost (gcc13): cast enum members to int in
prints
From: Jiri Slaby <jirislaby@...nel.org>
> Sent: 13 December 2022 12:05
>
> On 13. 12. 22, 12:50, David Laight wrote:
> > From: Jiri Slaby
> >> Sent: 13 December 2022 11:15
> >>
...
> >>>> 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};
> >>
> >> But having ull in an enum is undefined anyway. C99 allows only int
> >> constants. gnuC supports ulong expressions (IIRC).
> >
> > gcc supports 'long long' as well - 64bit on 32bit systems.
>
> Can you elaborate what's source of this? ...
Experimentation, for example:
https://godbolt.org/z/n4rnc7cKG
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists