From f4d805462a86a64ac70192a1023c4ebaf4c4e2394a097d434fcc1c35c37fbae5 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 30 Mar 2018 10:02:43 +0000 Subject: [PATCH] Accepting request 591726 from KDE:Qt5 - Add patch to fix build with GCC 8 (boo#1087073): * 0001-Do-a-static_cast-in-bit-blasts-that-are-UB.patch OBS-URL: https://build.opensuse.org/request/show/591726 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=79 --- ...tatic_cast-in-bit-blasts-that-are-UB.patch | 103 ++++++++++++++++++ libqt5-qtbase.changes | 6 + libqt5-qtbase.spec | 1 + 3 files changed, 110 insertions(+) create mode 100644 0001-Do-a-static_cast-in-bit-blasts-that-are-UB.patch diff --git a/0001-Do-a-static_cast-in-bit-blasts-that-are-UB.patch b/0001-Do-a-static_cast-in-bit-blasts-that-are-UB.patch new file mode 100644 index 0000000..b07d9f7 --- /dev/null +++ b/0001-Do-a-static_cast-in-bit-blasts-that-are-UB.patch @@ -0,0 +1,103 @@ +From 5a53a9893c50cf01fb3b93d256bbc669f99c16ea Mon Sep 17 00:00:00 2001 +From: Ville Voutilainen +Date: Fri, 12 Jan 2018 16:29:00 +0200 +Subject: [PATCH] Do a static_cast in bit-blasts that are UB +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Without this, building Qt and Qt applications fails with GCC 8. +The errors look like this: +writing to an object of type ‘class QPointer’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] + +Task-number: QTBUG-65691 +Change-Id: Ie5a30814125deca7a160b9a61f5aa3f944ee1ac9 +Reviewed-by: Qt CI Bot +Reviewed-by: Thiago Macieira +--- + src/gui/painting/qmatrix.h | 4 ++-- + src/gui/painting/qtransform.h | 6 +++--- + src/gui/text/qtextengine_p.h | 8 ++++---- + src/gui/text/qtextobject.h | 4 ++-- + 4 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h +index 15e0ab5be1..dafb746bc6 100644 +--- a/src/gui/painting/qmatrix.h ++++ b/src/gui/painting/qmatrix.h +@@ -65,10 +65,10 @@ public: + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + // ### Qt 6: remove; the compiler-generated ones are fine! + QMatrix &operator=(QMatrix &&other) Q_DECL_NOTHROW // = default +- { memcpy(this, &other, sizeof(QMatrix)); return *this; } ++ { memcpy(static_cast(this), static_cast(&other), sizeof(QMatrix)); return *this; } + QMatrix &operator=(const QMatrix &) Q_DECL_NOTHROW; // = default + QMatrix(QMatrix &&other) Q_DECL_NOTHROW // = default +- { memcpy(this, &other, sizeof(QMatrix)); } ++ { memcpy(static_cast(this), static_cast(&other), sizeof(QMatrix)); } + QMatrix(const QMatrix &other) Q_DECL_NOTHROW; // = default + #endif + +diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h +index 06ae611861..efb0fd7e83 100644 +--- a/src/gui/painting/qtransform.h ++++ b/src/gui/painting/qtransform.h +@@ -78,14 +78,14 @@ public: + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + // ### Qt 6: remove; the compiler-generated ones are fine! + QTransform &operator=(QTransform &&other) Q_DECL_NOTHROW // = default +- { memcpy(this, &other, sizeof(QTransform)); return *this; } ++ { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); return *this; } + QTransform &operator=(const QTransform &) Q_DECL_NOTHROW; // = default + QTransform(QTransform &&other) Q_DECL_NOTHROW // = default + : affine(Qt::Uninitialized) +- { memcpy(this, &other, sizeof(QTransform)); } ++ { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); } + QTransform(const QTransform &other) Q_DECL_NOTHROW // = default + : affine(Qt::Uninitialized) +- { memcpy(this, &other, sizeof(QTransform)); } ++ { memcpy(static_cast(this), static_cast(&other), sizeof(QTransform)); } + #endif + + bool isAffine() const; +diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h +index 89f1328241..90c1a12acd 100644 +--- a/src/gui/text/qtextengine_p.h ++++ b/src/gui/text/qtextengine_p.h +@@ -236,13 +236,13 @@ struct QGlyphLayout + last = numGlyphs; + if (first == 0 && last == numGlyphs + && reinterpret_cast(offsets + numGlyphs) == reinterpret_cast(glyphs)) { +- memset(offsets, 0, (numGlyphs * SpaceNeeded)); ++ memset(static_cast(offsets), 0, (numGlyphs * SpaceNeeded)); + } else { + const int num = last - first; +- memset(offsets + first, 0, num * sizeof(QFixedPoint)); ++ memset(static_cast(offsets + first), 0, num * sizeof(QFixedPoint)); + memset(glyphs + first, 0, num * sizeof(glyph_t)); +- memset(advances + first, 0, num * sizeof(QFixed)); +- memset(justifications + first, 0, num * sizeof(QGlyphJustification)); ++ memset(static_cast(advances + first), 0, num * sizeof(QFixed)); ++ memset(static_cast(justifications + first), 0, num * sizeof(QGlyphJustification)); + memset(attributes + first, 0, num * sizeof(QGlyphAttributes)); + } + } +diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h +index a5030de112..4cc2535b58 100644 +--- a/src/gui/text/qtextobject.h ++++ b/src/gui/text/qtextobject.h +@@ -154,9 +154,9 @@ public: + iterator(const iterator &o) Q_DECL_NOTHROW; // = default + iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default + iterator(iterator &&other) Q_DECL_NOTHROW // = default +- { memcpy(this, &other, sizeof(iterator)); } ++ { memcpy(static_cast(this), static_cast(&other), sizeof(iterator)); } + iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default +- { memcpy(this, &other, sizeof(iterator)); return *this; } ++ { memcpy(static_cast(this), static_cast(&other), sizeof(iterator)); return *this; } + #endif + + QTextFrame *parentFrame() const { return f; } +-- +2.16.2 + diff --git a/libqt5-qtbase.changes b/libqt5-qtbase.changes index efd68b9..9eddb52 100644 --- a/libqt5-qtbase.changes +++ b/libqt5-qtbase.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Mar 27 18:22:40 UTC 2018 - fabian@ritter-vogt.de + +- Add patch to fix build with GCC 8 (boo#1087073): + * 0001-Do-a-static_cast-in-bit-blasts-that-are-UB.patch + ------------------------------------------------------------------- Fri Mar 9 15:15:25 UTC 2018 - crrodriguez@opensuse.org diff --git a/libqt5-qtbase.spec b/libqt5-qtbase.spec index af3f08f..a2b173b 100644 --- a/libqt5-qtbase.spec +++ b/libqt5-qtbase.spec @@ -101,6 +101,7 @@ Patch2025: 0015-CUPS-Dont-show-choices-that-conflict-with-the-printer-insta Patch2026: 0016-CUPS-Rework-set-clearCupsOption-API.patch Patch2027: 0017-Cups-Print-Dialog-Change-the-message-box-titles-to-C.patch Patch2028: 0018-Fix-build-due-to-missing-QDebug-include.patch +Patch2029: 0001-Do-a-static_cast-in-bit-blasts-that-are-UB.patch BuildRequires: alsa-devel BuildRequires: cups-devel BuildRequires: double-conversion-devel