aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/decl2.c4
-rw-r--r--gcc/cp/semantics.c3
5 files changed, 19 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 52744d8..8ab0048 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2014-06-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * decl.c (duplicate_decls): Use set_decl_tls_model.
+ (grokdeclarator): Likewise.
+ * semantics.c (finish_id_expression): Check TLS only for
+ static variables.
+ (finish_omp_threadprivate): Use decl_default_tls_model.
+ * decl2.c (get_guard): Likewise.
+ * call.c (make_temporary_var_for_ref_to_temp): Likewise.
+
2014-06-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/33101
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 44e92fc..1d4c4f9 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -9387,7 +9387,7 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
tree name;
TREE_STATIC (var) = TREE_STATIC (decl);
- DECL_TLS_MODEL (var) = DECL_TLS_MODEL (decl);
+ set_decl_tls_model (var, DECL_TLS_MODEL (decl));
name = mangle_ref_init_variable (decl);
DECL_NAME (var) = name;
SET_DECL_ASSEMBLER_NAME (var, name);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2908224..1c8d497 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1952,7 +1952,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (!DECL_LANG_SPECIFIC (newdecl))
retrofit_lang_decl (newdecl);
- DECL_TLS_MODEL (newdecl) = DECL_TLS_MODEL (olddecl);
+ set_decl_tls_model (newdecl, DECL_TLS_MODEL (olddecl));
CP_DECL_THREADPRIVATE_P (newdecl) = 1;
}
}
@@ -8016,7 +8016,8 @@ grokvardecl (tree type,
if (decl_spec_seq_has_spec_p (declspecs, ds_thread))
{
- DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ if (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
if (declspecs->gnu_thread_keyword_p)
DECL_GNU_TLS_P (decl) = true;
}
@@ -10699,7 +10700,7 @@ grokdeclarator (const cp_declarator *declarator,
if (thread_p)
{
- DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
if (declspecs->gnu_thread_keyword_p)
DECL_GNU_TLS_P (decl) = true;
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 602a0c5..99ea582 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2939,7 +2939,7 @@ get_guard (tree decl)
TREE_STATIC (guard) = TREE_STATIC (decl);
DECL_COMMON (guard) = DECL_COMMON (decl);
DECL_COMDAT (guard) = DECL_COMDAT (decl);
- DECL_TLS_MODEL (guard) = DECL_TLS_MODEL (decl);
+ set_decl_tls_model (guard, DECL_TLS_MODEL (decl));
if (DECL_ONE_ONLY (decl))
make_decl_one_only (guard, cxx_comdat_group (guard));
if (TREE_PUBLIC (decl))
@@ -4212,7 +4212,7 @@ handle_tls_init (void)
DECL_ARTIFICIAL (guard) = true;
DECL_IGNORED_P (guard) = true;
TREE_USED (guard) = true;
- DECL_TLS_MODEL (guard) = decl_default_tls_model (guard);
+ set_decl_tls_model (guard, decl_default_tls_model (guard));
pushdecl_top_level_and_finish (guard, NULL_TREE);
tree fn = get_local_tls_init_fn ();
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ca0c34b..ec510c9 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3493,6 +3493,7 @@ finish_id_expression (tree id_expression,
tree wrap;
if (VAR_P (decl)
&& !cp_unevaluated_operand
+ && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
&& DECL_THREAD_LOCAL_P (decl)
&& (wrap = get_tls_wrapper_fn (decl)))
{
@@ -5956,7 +5957,7 @@ finish_omp_threadprivate (tree vars)
if (! DECL_THREAD_LOCAL_P (v))
{
- DECL_TLS_MODEL (v) = decl_default_tls_model (v);
+ set_decl_tls_model (v, decl_default_tls_model (v));
/* If rtl has been already set for this var, call
make_decl_rtl once again, so that encode_section_info
has a chance to look at the new decl flags. */