Package: src:qt6-base
Version: 6.11.2+dfsg-7  
Severity: important
User: [email protected]
Usertags: m68k
X-Debbugs-CC: [email protected]
Tags: ftbfs patch

The 2 least significant bits in pointers to QEventLoop, QThread and
QCoreApplication are used for type tagging. This requires a minimum
alignment of 4. Force the alignment to be at least 4 to support
architectures where the default alignment is smaller (m68k).

This fixes compilation errors on Debian for Motorola 68000 (m68k):

.../src/corelib/kernel/qeventloop.cpp:329:35: error: static assertion
failed
  329 | static_assert(alignof(QEventLoop) >= 4);
      |               ~~~~~~~~~~~~~~~~~~~~^~~~
  • the comparison reduces to ‘(2 >= 4)’
.../src/corelib/kernel/qeventloop.cpp:330:32: error: static assertion
failed
  330 | static_assert(alignof(QThread) >= 4);
      |               ~~~~~~~~~~~~~~~~~^~~~
  • the comparison reduces to ‘(2 >= 4)’
.../src/corelib/kernel/qeventloop.cpp:331:41: error: static assertion
failed
  331 | static_assert(alignof(QCoreApplication) >= 4);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
  • the comparison reduces to ‘(2 >= 4)’

My testbuild on the m68k porterbox mitchy.debian.net ran out of disk
space, but it successfully built the libQt6Core library before this
with the attached patch applied.

        Mattias
From 8e1c1eed35e74285e9c6530510ef4f1cd177b9b4 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <[email protected]>
Date: Thu, 29 Oct 2026 01:42:23 +0100
Subject: [PATCH] The 2 least significant bits in pointers to QEventLoop,
 QThread and QCoreApplication are used for type tagging. This requires a
 minimum alignment of 4. Force the alignment to be at least 4 to support
 architectures where the default alignment is smaller (m68k).
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes compilation errors on Debian for Motorola 68000 (m68k):

.../src/corelib/kernel/qeventloop.cpp:329:35: error: static assertion failed
  329 | static_assert(alignof(QEventLoop) >= 4);
      |               ~~~~~~~~~~~~~~~~~~~~^~~~
  • the comparison reduces to ‘(2 >= 4)’
.../src/corelib/kernel/qeventloop.cpp:330:32: error: static assertion failed
  330 | static_assert(alignof(QThread) >= 4);
      |               ~~~~~~~~~~~~~~~~~^~~~
  • the comparison reduces to ‘(2 >= 4)’
.../src/corelib/kernel/qeventloop.cpp:331:41: error: static assertion failed
  331 | static_assert(alignof(QCoreApplication) >= 4);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
  • the comparison reduces to ‘(2 >= 4)’
---
 src/corelib/kernel/qcoreapplication.h | 8 +++++++-
 src/corelib/kernel/qeventloop.h       | 7 ++++++-
 src/corelib/thread/qthread.h          | 7 ++++++-
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 9deca609e83..d04cb414817 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -38,7 +38,13 @@ class QTranslator;
 #define qApp QCoreApplication::instance()
 
 class QCoreApplicationPrivate;
-class Q_CORE_EXPORT QCoreApplication
+
+// The 2 least significant bits in pointers to this class are used for
+// type tagging. This requires a minimum alignment of 4. Force the
+// alignment to be at least 4 to support architectures where the
+// default alignment is smaller (m68k).
+
+class alignas(4) Q_CORE_EXPORT QCoreApplication
 #ifndef QT_NO_QOBJECT
     : public QObject
 #endif
diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h
index f69d5d2a09b..95529391c71 100644
--- a/src/corelib/kernel/qeventloop.h
+++ b/src/corelib/kernel/qeventloop.h
@@ -13,7 +13,12 @@ QT_BEGIN_NAMESPACE
 class QEventLoopLocker;
 class QEventLoopPrivate;
 
-class Q_CORE_EXPORT QEventLoop : public QObject
+// The 2 least significant bits in pointers to this class are used for
+// type tagging. This requires a minimum alignment of 4. Force the
+// alignment to be at least 4 to support architectures where the
+// default alignment is smaller (m68k).
+
+class alignas(4) Q_CORE_EXPORT QEventLoop : public QObject
 {
     Q_OBJECT
     Q_DECLARE_PRIVATE(QEventLoop)
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index f4c265e1912..b5160fddb98 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -25,7 +25,12 @@ class QThreadPrivate;
 class QAbstractEventDispatcher;
 class QEventLoopLocker;
 
-class Q_CORE_EXPORT QThread : public QObject
+// The 2 least significant bits in pointers to this class are used for
+// type tagging. This requires a minimum alignment of 4. Force the
+// alignment to be at least 4 to support architectures where the
+// default alignment is smaller (m68k).
+
+class alignas(4) Q_CORE_EXPORT QThread : public QObject
 {
     Q_OBJECT
 public:
-- 
2.56.0

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to