summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-14 22:28:07 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-14 22:28:07 +0000
commitea1fb9e5f8351288cb7023dd3fbe7ad1560ee60b (patch)
tree96e1255b764e798c3eafe4ea4ecfcc39128e60e1
parente1e4663f47ccd4d3d88a9ee7b3bc35e109826845 (diff)
downloadgcc-ea1fb9e5f8351288cb7023dd3fbe7ad1560ee60b.tar.gz
/cp
2015-01-14 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58671 * decl2.c (var_defined_without_dynamic_init): Handle gracefully self-initialization. /testsuite 2015-01-14 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58671 * g++.dg/tls/thread_local-ice3.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219621 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl2.c7
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/tls/thread_local-ice3.C5
4 files changed, 22 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 013c432a661..02b4fac907b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58671
+ * decl2.c (var_defined_without_dynamic_init): Handle gracefully
+ self-initialization.
+
2015-01-13 Jason Merrill <jason@redhat.com>
PR c++/64356
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index e59a8f9058d..a7bc08f6e56 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3094,8 +3094,11 @@ var_defined_without_dynamic_init (tree var)
counts as dynamic initialization. */
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (var)))
return false;
- /* If it's in this TU, its initializer has been processed. */
- gcc_assert (DECL_INITIALIZED_P (var));
+ /* If it's in this TU, its initializer has been processed, unless
+ it's a case of self-initialization, then DECL_INITIALIZED_P is
+ false while the initializer is handled by finish_id_expression. */
+ if (!DECL_INITIALIZED_P (var))
+ return false;
/* If it has no initializer or a constant one, it's not dynamic. */
return (!DECL_NONTRIVIALLY_INITIALIZED_P (var)
|| DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (var));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 061aa7e0810..e58d7098f98 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58671
+ * g++.dg/tls/thread_local-ice3.C: New.
+
2015-01-14 H.J. Lu <hongjiu.lu@intel.com>
* gcc.target/i386/fentry-override.c: Properly place {} in target
@@ -9,7 +14,6 @@
* gcc.dg/atomic-invalid.c: Check for invalid memory model
warnings instead of errors.
-
2015-01-14 Ilya Verbin <ilya.verbin@intel.com>
* lib/target-supports.exp (check_effective_target_lto): Check for -flto
@@ -64,7 +68,7 @@
PR lto/64415
* gcc.dg/lto/pr64415_0.c: New testcase.
- * gcc.dg/lto/pr64415_1.c: Likewise.
+ * gcc.dg/lto/pr64415_1.c: Likewise.
2015-01-14 Martin Liska <mliska@suse.cz>
diff --git a/gcc/testsuite/g++.dg/tls/thread_local-ice3.C b/gcc/testsuite/g++.dg/tls/thread_local-ice3.C
new file mode 100644
index 00000000000..d061a239f6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tls/thread_local-ice3.C
@@ -0,0 +1,5 @@
+// PR c++/58671
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target tls }
+
+thread_local int i = i;