From: Jakub Jelinek Date: Wed, 6 Sep 2017 09:10:26 +0000 (+0200) Subject: re PR middle-end/82095 (ICE in tree_nop_conversion at tree.c:11793 on ppc64le) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3581d5dbf0c6be20e837ea27092b38f5de23c93b;p=gcc.git re PR middle-end/82095 (ICE in tree_nop_conversion at tree.c:11793 on ppc64le) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f6ba412aeb0..e35d6b35b22 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-06 Jakub Jelinek + + 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 * gimple-ssa-strength-reduction.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 667d1cbcbba..2b168296cd7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-09-06 Jakub Jelinek + + PR middle-end/82095 + * gcc.dg/tls/pr82095.c: New test. + 2017-09-05 Jakub Jelinek PR middle-end/81768 diff --git a/gcc/testsuite/gcc.dg/tls/pr82095.c b/gcc/testsuite/gcc.dg/tls/pr82095.c new file mode 100644 index 00000000000..5713a3ba24a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/pr82095.c @@ -0,0 +1,16 @@ +/* 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; +} diff --git a/gcc/varasm.c b/gcc/varasm.c index f2a12f0495f..6177eec118b 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6562,8 +6562,9 @@ categorize_decl_for_section (const_tree decl, int reloc) /* 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;