Hi,

I was affected by this, too when compiling Gpg4win. Caused an error in Boost 
and the mentioned Qt error.

I want to thank you very much for investigating and causing this bug to be 
fixed. I've compiled myself packages with the fix from https://gcc.gnu.org/
bugzilla/show_bug.cgi?id=88568  (diff attached)

With this fix I was able to fully compile Gpg4win again (which includes a ton 
of packages like gtk+, qt, boost, kde-frameworks, etc..).

Best Regards,
Andre

-- 
GnuPG e.V., Rochusstr. 44, D-40479 Düsseldorf.  VR 11482 Düsseldorf
Vorstand: W.Koch, M.Gollowitzer, A.Heinecke.    Mail: bo...@gnupg.org
Finanzamt D-Altstadt, St-Nr: 103/5923/1779.   Tel: +49-2104-4938799
>From 2ddbe8e4d39d145b2aa0356c9ff6835bda73abf5 Mon Sep 17 00:00:00 2001
From: Andre Heinecke <aheine...@gnupg.org>
Date: Tue, 5 Mar 2019 18:35:12 +0100
Subject: [PATCH] Fix gcc bug-88568

---
 debian/changelog               |  6 +++++
 debian/patches/bug-88568.patch | 40 ++++++++++++++++++++++++++++++++++
 debian/patches/series2         |  1 +
 3 files changed, 47 insertions(+)
 create mode 100644 debian/patches/bug-88568.patch

diff --git a/debian/changelog b/debian/changelog
index d9b3631..f72efab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+gcc-mingw-w64 (21.2~aheinecke1) unstable; urgency=medium
+
+  * Add patch for g++ bug 88568 (closes: #923214)
+
+ -- Andre Heinecke <aheine...@gnupg.org>  Tue, 05 Mar 2019 16:21:03 +0100
+
 gcc-mingw-w64 (21.1) unstable; urgency=medium
 
   * Avoid attempting to strip plugins using the target strip; should fix
diff --git a/debian/patches/bug-88568.patch b/debian/patches/bug-88568.patch
new file mode 100644
index 0000000..dbc76df
--- /dev/null
+++ b/debian/patches/bug-88568.patch
@@ -0,0 +1,40 @@
+2019-03-05  Jakub Jelinek  <ja...@redhat.com>
+
+	PR c/88568
+	* attribs.c (handle_dll_attribute): Don't clear TREE_STATIC for
+	dllimport on VAR_DECLs with RECORD_TYPE or UNION_TYPE DECL_CONTEXT.
+
+	* g++.dg/other/pr88568.C: New test.
+
+--- gcc-mingw-w64.orig/src/gcc/attribs.c.jj	2019-01-10 11:44:07.122511397 +0100
++++ gcc-mingw-w64/src/gcc/attribs.c	2019-03-05 13:59:51.745924578 +0100
+@@ -1691,8 +1691,11 @@ handle_dll_attribute (tree * pnode, tree
+ 	     a function global scope, unless declared static.  */
+ 	  if (current_function_decl != NULL_TREE && !TREE_STATIC (node))
+ 	    TREE_PUBLIC (node) = 1;
+-	  /* Clear TREE_STATIC because DECL_EXTERNAL is set.  */
+-	  TREE_STATIC (node) = 0;
++	  /* Clear TREE_STATIC because DECL_EXTERNAL is set, unless
++	     it is a C++ static data member.  */
++	  if (DECL_CONTEXT (node) == NULL_TREE
++	      || !RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (node)))
++	    TREE_STATIC (node) = 0;
+ 	}
+ 
+       if (*no_add_attrs == false)
+--- gcc-mingw-w64.orig/src/gcc/testsuite/g++.dg/other/pr88568.C.jj	2019-03-05 14:03:20.132509560 +0100
++++ gcc-mingw-w64/src/gcc/testsuite/g++.dg/other/pr88568.C	2019-03-05 14:01:39.674155860 +0100
+@@ -0,0 +1,13 @@
++// PR c/88568
++// { dg-do compile }
++// { dg-require-dll "" }
++
++struct S {
++  __attribute__((dllimport)) static const char foo[];
++};
++
++int
++foo (int x)
++{
++  return S::foo[x];
++}
diff --git a/debian/patches/series2 b/debian/patches/series2
index 6f5002f..e6543c6 100644
--- a/debian/patches/series2
+++ b/debian/patches/series2
@@ -8,3 +8,4 @@ filesystem_error-no-throw-copyable.patch
 overload-distance-and-advance.patch
 #update-path-compare-logic.patch
 #fix-filesystem-path-lexically_normal.patch
+bug-88568.patch
-- 
2.20.1

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

Reply via email to