+2018-03-05 Pádraig Brady <P@draigBrady.com>
+ Jason Merrill <jason@redhat.com>
+ Nathan Sidwell <nathan@acm.org>
+
+ PR c++/84497
+ * decl2.c (get_tls_init_fn): Check TYPE_HAS_TRIVIAL_DFLT too.
+
2018-03-03 Jason Merrill <jason@redhat.com>
PR c++/84686 - missing volatile loads.
/* If the variable is defined somewhere else and might have static
initialization, make the init function a weak reference. */
if ((!TYPE_NEEDS_CONSTRUCTING (obtype)
- || TYPE_HAS_CONSTEXPR_CTOR (obtype))
+ || TYPE_HAS_CONSTEXPR_CTOR (obtype)
+ || TYPE_HAS_TRIVIAL_DFLT (obtype))
&& TYPE_HAS_TRIVIAL_DESTRUCTOR (obtype)
&& DECL_EXTERNAL (var))
declare_weak (fn);
+2018-03-05 Pádraig Brady <P@draigBrady.com>
+ Nathan Sidwell <nathan@acm.org>
+
+ PR c++/84497
+ * g++.dg/cpp0x/pr84497.C: New.
+
2018-03-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/84670
--- /dev/null
+// PR 84497 mismatch with thread constructor fn weakness
+// { dg-do compile { target c++11 } }
+// { dg-require-weak "" }
+
+struct Base
+{
+ int m;
+
+ Base() noexcept = default; // trivial but not constexpr
+ ~Base() noexcept = default;
+};
+
+struct Derived : Base {};
+struct Container {
+ Base m;
+};
+
+#ifdef DEF
+// This bit for exposition only.
+// All items placed in .tbss
+// __tls_init simply sets __tls_guard
+// no aliases to __tls_init generated
+thread_local Base base_obj;
+thread_local Derived derived_obj;
+thread_local Container container_obj;
+#else
+// Erroneously created strong undef refs to
+// _ZTH11derived_obj, _ZTH13container_obj, _ZTH8base_obj
+extern thread_local Base base_obj;
+extern thread_local Derived derived_obj;
+extern thread_local Container container_obj;
+int main() { return !(&base_obj && &derived_obj && &container_obj);}
+#endif
+
+// { dg-final { scan-assembler ".weak\[ \t\]*_ZTH8base_obj" } }
+// { dg-final { scan-assembler ".weak\[ \t\]*_ZTH11derived_obj" } }
+// { dg-final { scan-assembler ".weak\[ \t\]*_ZTH13container_obj" } }