lkml.org 
[lkml]   [2023]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] workqueue: fix enum type for gcc-13
Date
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)

\
 
 \ /
  Last update: 2023-03-26 23:45    [W:0.063 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site