Bug 271108 - REGRESSION(274077@main): failure to build on i586 (and likely other 32bit arches): static assertion failed: Timer should stay small
Summary: REGRESSION(274077@main): failure to build on i586 (and likely other 32bit arc...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-16 03:22 PDT by Dominique Leuenberger
Modified: 2024-03-18 11:16 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique Leuenberger 2024-03-16 03:22:59 PDT
[ 1646s] In file included from /home/abuild/rpmbuild/BUILD/webkitgtk-2.44.0/build/WebCore/DerivedSources/unified-sources/UnifiedSource-3c72abbe-12.cpp:2:
[ 1646s] /home/abuild/rpmbuild/BUILD/webkitgtk-2.44.0/Source/WebCore/platform/Timer.cpp:269:29: error: static assertion failed: Timer should stay small
[ 1646s]   269 | static_assert(sizeof(Timer) == sizeof(SameSizeAsTimer), "Timer should stay small");
[ 1646s]       |               ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
[ 1646s] /home/abuild/rpmbuild/BUILD/webkitgtk-2.44.0/Source/WebCore/platform/Timer.cpp:269:29: note: the comparison reduces to ‘(40 == 36)’
[ 1646s] /home/abuild/rpmbuild/BUILD/webkitgtk-2.44.0/Source/WebCore/platform/Timer.cpp:275:46: error: static assertion failed: DeferrableOneShotTimer should stay small
[ 1646s]   275 | static_assert(sizeof(DeferrableOneShotTimer) == sizeof(SameSizeAsDeferrableOneShotTimer), "DeferrableOneShotTimer should stay small");
[ 1646s]       |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment 1 Dominique Leuenberger 2024-03-16 03:23:49 PDT
Version 2.43.4 was the last I tested and that still built successfylly
Comment 2 Michael Catanzaro 2024-03-16 15:38:21 PDT
I think SameSizeAsTimer is missing the size of the bitfields, which don't get compacted on 32-bit architectures. Let me test it...
Comment 3 Michael Catanzaro 2024-03-16 17:45:11 PDT
Hey Ryosuke, are you OK with this? I will create a pull request soon.

(Alternatively, we could put the uint8_t at the bottom of the struct by reordering the Timer data members.)

diff --git a/Source/WebCore/platform/Timer.cpp b/Source/WebCore/platform/Timer.cpp
index 4f7c0f5c39ca..0f3734cca247 100644
--- a/Source/WebCore/platform/Timer.cpp
+++ b/Source/WebCore/platform/Timer.cpp
@@ -263,7 +263,11 @@ struct SameSizeAsTimer {
 
     WeakPtr<TimerAlignment> timerAlignment;
     double times[2];
-    void* pointers[3];
+    void* pointers[2];
+#if CPU(ADDRESS32)
+    uint8_t bitfields;
+#endif
+    void* pointer;
 };
 
 static_assert(sizeof(Timer) == sizeof(SameSizeAsTimer), "Timer should stay small");
Comment 4 Michael Catanzaro 2024-03-18 09:57:22 PDT
Pull request: https://github.com/WebKit/WebKit/pull/26053
Comment 5 EWS 2024-03-18 11:16:22 PDT
Committed 276282@main (2922af379dc7): <https://commits.webkit.org/276282@main>

Reviewed commits have been landed. Closing PR #26053 and removing active labels.