re PR c++/58671 ([c++11] ICE with thread_local and self-referential variable initialization)

/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.

From-SVN: r219621
This commit is contained in:
Paolo Carlini 2015-01-14 22:28:07 +00:00
parent 622ef5dae9
commit 36b218ee8f
4 changed files with 22 additions and 4 deletions

View File

@ -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> 2015-01-13 Jason Merrill <jason@redhat.com>
PR c++/64356 PR c++/64356

View File

@ -3094,8 +3094,11 @@ var_defined_without_dynamic_init (tree var)
counts as dynamic initialization. */ counts as dynamic initialization. */
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (var))) if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (var)))
return false; return false;
/* If it's in this TU, its initializer has been processed. */ /* If it's in this TU, its initializer has been processed, unless
gcc_assert (DECL_INITIALIZED_P (var)); 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. */ /* If it has no initializer or a constant one, it's not dynamic. */
return (!DECL_NONTRIVIALLY_INITIALIZED_P (var) return (!DECL_NONTRIVIALLY_INITIALIZED_P (var)
|| DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (var)); || DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (var));

View File

@ -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> 2015-01-14 H.J. Lu <hongjiu.lu@intel.com>
* gcc.target/i386/fentry-override.c: Properly place {} in target * gcc.target/i386/fentry-override.c: Properly place {} in target
@ -9,7 +14,6 @@
* gcc.dg/atomic-invalid.c: Check for invalid memory model * gcc.dg/atomic-invalid.c: Check for invalid memory model
warnings instead of errors. warnings instead of errors.
2015-01-14 Ilya Verbin <ilya.verbin@intel.com> 2015-01-14 Ilya Verbin <ilya.verbin@intel.com>
* lib/target-supports.exp (check_effective_target_lto): Check for -flto * lib/target-supports.exp (check_effective_target_lto): Check for -flto

View File

@ -0,0 +1,5 @@
// PR c++/58671
// { dg-do compile { target c++11 } }
// { dg-require-effective-target tls }
thread_local int i = i;