PR middle-end/82095
* varasm.c (categorize_decl_for_section): Use SECCAT_TBSS for TLS vars with
NULL DECL_INITIAL.
* gcc.dg/tls/pr82095.c: New test.
From-SVN: r251754
+2017-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/82095
+ * varasm.c (categorize_decl_for_section): Use SECCAT_TBSS for TLS vars with
+ NULL DECL_INITIAL.
+
2017-09-06 Richard Biener <rguenther@suse.de>
* gimple-ssa-strength-reduction.c
+2017-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/82095
+ * gcc.dg/tls/pr82095.c: New test.
+
2017-09-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/81768
--- /dev/null
+/* PR middle-end/82095 */
+/* { dg-do compile } */
+/* { dg-options "-Og -fno-tree-ccp" } */
+/* { dg-require-effective-target tls } */
+/* { dg-add-options tls } */
+
+static int b;
+static __thread int c;
+
+void
+foo (void)
+{
+ if (b)
+ if (c)
+ b = 1;
+}
/* Note that this would be *just* SECCAT_BSS, except that there's
no concept of a read-only thread-local-data section. */
if (ret == SECCAT_BSS
- || (flag_zero_initialized_in_bss
- && initializer_zerop (DECL_INITIAL (decl))))
+ || DECL_INITIAL (decl) == NULL
+ || (flag_zero_initialized_in_bss
+ && initializer_zerop (DECL_INITIAL (decl))))
ret = SECCAT_TBSS;
else
ret = SECCAT_TDATA;