Patchwork [C++] PR 55801

login
register
mail settings
Submitter Paolo Carlini
Date Jan. 9, 2013, 1:54 a.m.
Message ID <50ECCDD2.5000608@oracle.com>
Download mbox | patch
Permalink /patch/210598/
State New
Headers show

Comments

Paolo Carlini - Jan. 9, 2013, 1:54 a.m.
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.

//////////////////////
/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.
Jason Merrill - Jan. 9, 2013, 2:18 p.m.
OK.

Jason

Patch

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" }