* [C++ Patch/RFC] PR 58671
@ 2015-01-14 13:28 Paolo Carlini
2015-01-14 15:09 ` Jason Merrill
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Carlini @ 2015-01-14 13:28 UTC (permalink / raw)
To: gcc-patches; +Cc: Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 189 bytes --]
Hi,
in order to avoid ICEing in var_defined_without_dynamic_init for
self-initialized thread_local vars, shall we simply return false for those?
Thanks,
Paolo.
//////////////////////
[-- Attachment #2: patch_58671 --]
[-- Type: text/plain, Size: 1164 bytes --]
Index: cp/decl2.c
===================================================================
--- cp/decl2.c (revision 219581)
+++ cp/decl2.c (working copy)
@@ -3094,8 +3094,10 @@ 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. */
+ 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));
Index: testsuite/g++.dg/tls/thread_local-ice3.C
===================================================================
--- testsuite/g++.dg/tls/thread_local-ice3.C (revision 0)
+++ testsuite/g++.dg/tls/thread_local-ice3.C (working copy)
@@ -0,0 +1,5 @@
+// PR c++/58671
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target tls }
+
+thread_local int i = i;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch/RFC] PR 58671
2015-01-14 13:28 [C++ Patch/RFC] PR 58671 Paolo Carlini
@ 2015-01-14 15:09 ` Jason Merrill
2015-01-14 15:19 ` Paolo Carlini
0 siblings, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2015-01-14 15:09 UTC (permalink / raw)
To: Paolo Carlini, gcc-patches
On 01/14/2015 08:13 AM, Paolo Carlini wrote:
> in order to avoid ICEing in var_defined_without_dynamic_init for
> self-initialized thread_local vars, shall we simply return false for those?
What is clearing DECL_INITIALIZED_P for such variables?
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch/RFC] PR 58671
2015-01-14 15:09 ` Jason Merrill
@ 2015-01-14 15:19 ` Paolo Carlini
2015-01-14 21:34 ` Jason Merrill
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Carlini @ 2015-01-14 15:19 UTC (permalink / raw)
To: Jason Merrill, gcc-patches
Hi,
On 01/14/2015 04:00 PM, Jason Merrill wrote:
> On 01/14/2015 08:13 AM, Paolo Carlini wrote:
>> in order to avoid ICEing in var_defined_without_dynamic_init for
>> self-initialized thread_local vars, shall we simply return false for
>> those?
>
> What is clearing DECL_INITIALIZED_P for such variables?
I can look again, but as far as I remember nothing is clearing it, it
just stay false because the ICE happens while we process the 'i' on the
right hand side and the DECL_INITIALIZED_P becomes true only in
cp_finish_decl.
Paolo.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch/RFC] PR 58671
2015-01-14 15:19 ` Paolo Carlini
@ 2015-01-14 21:34 ` Jason Merrill
0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2015-01-14 21:34 UTC (permalink / raw)
To: Paolo Carlini, gcc-patches
On 01/14/2015 10:08 AM, Paolo Carlini wrote:
> I can look again, but as far as I remember nothing is clearing it, it
> just stay false because the ICE happens while we process the 'i' on the
> right hand side and the DECL_INITIALIZED_P becomes true only in
> cp_finish_decl.
Ah, please say that in the comment. OK with that change.
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-14 21:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14 13:28 [C++ Patch/RFC] PR 58671 Paolo Carlini
2015-01-14 15:09 ` Jason Merrill
2015-01-14 15:19 ` Paolo Carlini
2015-01-14 21:34 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).