Bug 222480 - [GTK] Fails to build in i386: static assertion failed: divisor must be a power of two
Summary: [GTK] Fails to build in i386: static assertion failed: divisor must be a powe...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kimmo Kinnunen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-26 09:44 PST by Alberto Garcia
Modified: 2021-03-01 01:44 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.40 KB, patch)
2021-02-26 12:44 PST, Alberto Garcia
cgarcia: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Garcia 2021-02-26 09:44:03 PST
I can reproduce this with WebKitGTK 2.31.90:

In file included from DerivedSources/ForwardingHeaders/wtf/FastMalloc.h:26,
                 from ../Source/WebKit/config.h:42,
                 from DerivedSources/WebKit/WebPageProxyMessageReceiver.cpp:25:
DerivedSources/ForwardingHeaders/wtf/StdLibExtras.h: In instantiation of ‘constexpr size_t WTF::roundUpToMultipleOf(size_t) [with unsigned int divisor = 48; size_t = unsigned int]’:
../Source/WebKit/Platform/IPC/StreamConnectionBuffer.h:117:96:   required from here
DerivedSources/ForwardingHeaders/wtf/StdLibExtras.h:187:27: error: static assertion failed: divisor must be a power of two!
  187 |     static_assert(divisor && !(divisor & (divisor - 1)), "divisor must be a power of two!");
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As you can see 'divisor' is 48, I suspect that the problem is in sizeof(Header) due to the differences in size_t between 32-bit and 64-bit platforms:

https://trac.webkit.org/browser/webkit/trunk/Source/WebKit/Platform/IPC/StreamConnectionBuffer.h?rev=273204#L117
Comment 1 Alberto Garcia 2021-02-26 09:45:05 PST
This was added in r273204.
Comment 2 Kimmo Kinnunen 2021-02-26 10:12:21 PST
Thanks! It's a typo:
- roundUpToMultipleOf<sizeof(std::max_align_t)>
+ roundUpToMultipleOf<alignof(std::max_align_t)>
Comment 3 Kimmo Kinnunen 2021-02-26 10:13:27 PST
I can fix it on coming Monday the latest, if nobody gets around fixing it before.
Comment 4 Alberto Garcia 2021-02-26 12:44:11 PST
Created attachment 421699 [details]
Patch

Here is the patch, thanks!
Comment 5 Kimmo Kinnunen 2021-03-01 00:59:51 PST
Comment on attachment 421699 [details]
Patch

Thanks, looks good.
Comment 6 Alberto Garcia 2021-03-01 01:44:08 PST
Committed r273643: <https://commits.webkit.org/r273643>