mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Arnd Bergmann' <arnd@kernel.org>, Tejun Heo <tj@kernel.org>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Lai Jiangshan" <jiangshanlai@gmail.com>,
	"Richard Clark" <richard.xnu.clark@gmail.com>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	"Andrey Grodzovsky" <andrey.grodzovsky@amd.com>,
	"Tetsuo Handa" <penguin-kernel@I-love.SAKURA.ne.jp>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] workqueue: fix enum type for gcc-13
Date: Wed, 18 Jan 2023 09:31:18 +0000	[thread overview]
Message-ID: <99ea6e86d2594b40a6de96cc821c447b@AcuMS.aculab.com> (raw)
In-Reply-To: <20230117164041.1207412-1-arnd@kernel.org>

From: Arnd Bergmann
> Sent: 17 January 2023 16:41
> 
> In gcc-13, the WORK_STRUCT_WQ_DATA_MASK constant is a signed 64-bit
> type on 32-bit architectures because the enum definition has both
> negative numbers and numbers above LONG_MAX in it:
> 
...
>  	/* convenience constants */
>  	WORK_STRUCT_FLAG_MASK	= (1UL << WORK_STRUCT_FLAG_BITS) - 1,
> -	WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
> +	WORK_STRUCT_WQ_DATA_MASK = (unsigned long)~WORK_STRUCT_FLAG_MASK,
>  	WORK_STRUCT_NO_POOL	= (unsigned long)WORK_OFFQ_POOL_NONE << WORK_OFFQ_POOL_SHIFT,

How can that make any difference?
You aren't changing the value or type (which makes no difference)
of WORK_STRUCT_WQ_DATA_MASK.
Indeed you require it to have the high bit set.

So if the enum contains a -1 somewhere gcc-13 will promote
everything to s64.

Either declare gcc-13 as 'BROKEN' or change the:
	return (void *)(data & WORK_STRUCT_WQ_DATA_MASK);
to
	return (void *)(data & ~WORK_STRUCT_FLAG_MASK);

or use #defines.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2023-01-18 10:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 16:40 Arnd Bergmann
2023-01-18  9:31 ` David Laight [this message]
2023-01-18 16:38   ` Tejun Heo
2023-01-18 20:32     ` Arnd Bergmann
2023-01-19  1:41       ` Tejun Heo
2023-01-19  9:21         ` David Laight
2023-05-08 15:23 ` Thierry Reding
2023-05-09  3:26 ` Lai Jiangshan
2023-05-21  2:40 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99ea6e86d2594b40a6de96cc821c447b@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=andrey.grodzovsky@amd.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=richard.xnu.clark@gmail.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome