* [C++ Patch] PR 55801
@ 2013-01-08 11:22 Paolo Carlini
2013-01-08 20:16 ` Jason Merrill
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Carlini @ 2013-01-08 11:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
Hi,
a simple ICE on invalid: the problem manifests itself when, during error
recovery, var_defined_without_dynamic_init does
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (var)) for a VAR_DECL which
has error_mark_node as TREE_TYPE.
It seems to me that a good place to avoid this is finish_id_expression
(a bit earlier), where we already use error_operand_p, by not calling at
all get_tls_wrapper_fn on such a decl.
Tested x86_64-linux.
Thanks,
Paolo.
/////////////////
[-- Attachment #2: CL_55801 --]
[-- Type: text/plain, Size: 308 bytes --]
/cp
2013-01-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55801
* semantics.c (finish_id_expression): Don't call get_tls_wrapper_fn
on a decl with error_mark_node as TREE_TYPE.
/testsuite
2013-01-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55801
* g++.dg/tls/thread_local-ice.C: New.
[-- Attachment #3: patch_55801 --]
[-- Type: text/plain, Size: 1278 bytes --]
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 195008)
+++ cp/semantics.c (working copy)
@@ -3,7 +3,7 @@
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
- Copyright (C) 1998-2012 Free Software Foundation, Inc.
+ Copyright (C) 1998-2013 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
@@ -3290,8 +3290,9 @@ finish_id_expression (tree id_expression,
}
tree wrap;
- if (TREE_CODE (decl) == VAR_DECL
- && !cp_unevaluated_operand
+ if (! error_operand_p (decl)
+ && TREE_CODE (decl) == VAR_DECL
+ && ! cp_unevaluated_operand
&& DECL_THREAD_LOCAL_P (decl)
&& (wrap = get_tls_wrapper_fn (decl)))
{
Index: testsuite/g++.dg/tls/thread_local-ice.C
===================================================================
--- testsuite/g++.dg/tls/thread_local-ice.C (revision 0)
+++ testsuite/g++.dg/tls/thread_local-ice.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/55801
+// { dg-options "-std=c++11" }
+// { dg-require-effective-target tls }
+
+class C;
+thread_local C O, O2 = O; // { dg-error "incomplete" }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch] PR 55801
2013-01-08 11:22 [C++ Patch] PR 55801 Paolo Carlini
@ 2013-01-08 20:16 ` Jason Merrill
2013-01-09 1:54 ` Paolo Carlini
0 siblings, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2013-01-08 20:16 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches
I think I'd rather handle this by returning false from
var_needs_tls_wrapper.
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch] PR 55801
2013-01-08 20:16 ` Jason Merrill
@ 2013-01-09 1:54 ` Paolo Carlini
2013-01-09 14:18 ` Jason Merrill
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Carlini @ 2013-01-09 1:54 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
Hi,
On 01/08/2013 09:00 PM, Jason Merrill wrote:
> I think I'd rather handle this by returning false from
> var_needs_tls_wrapper.
Ah Ok. Then what about the below?
Thanks,
Paolo.
//////////////////////
[-- Attachment #2: CL_55801_2 --]
[-- Type: text/plain, Size: 289 bytes --]
/cp
2013-01-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55801
* decl2.c (var_needs_tls_wrapper): Return false when error_operand_p
of the argument is true.
/testsuite
2013-01-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55801
* g++.dg/tls/thread_local-ice.C: New.
[-- Attachment #3: patch_55801_2 --]
[-- Type: text/plain, Size: 1315 bytes --]
Index: cp/decl2.c
===================================================================
--- cp/decl2.c (revision 195043)
+++ cp/decl2.c (working copy)
@@ -1,7 +1,7 @@
/* Process declarations and variables for C++ compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
- 2011, 2012 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007-2013
+ Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
@@ -2807,7 +2807,8 @@ var_defined_without_dynamic_init (tree var)
static bool
var_needs_tls_wrapper (tree var)
{
- return (DECL_THREAD_LOCAL_P (var)
+ return (!error_operand_p (var)
+ && DECL_THREAD_LOCAL_P (var)
&& !DECL_GNU_TLS_P (var)
&& !DECL_FUNCTION_SCOPE_P (var)
&& !var_defined_without_dynamic_init (var));
Index: testsuite/g++.dg/tls/thread_local-ice.C
===================================================================
--- testsuite/g++.dg/tls/thread_local-ice.C (revision 0)
+++ testsuite/g++.dg/tls/thread_local-ice.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/55801
+// { dg-options "-std=c++11" }
+// { dg-require-effective-target tls }
+
+class C;
+thread_local C O, O2 = O; // { dg-error "incomplete" }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [C++ Patch] PR 55801
2013-01-09 1:54 ` Paolo Carlini
@ 2013-01-09 14:18 ` Jason Merrill
0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2013-01-09 14:18 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches
OK.
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-09 14:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-08 11:22 [C++ Patch] PR 55801 Paolo Carlini
2013-01-08 20:16 ` Jason Merrill
2013-01-09 1:54 ` Paolo Carlini
2013-01-09 14:18 ` 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).