Commit 5df27e4a by Jakub Jelinek Committed by Jakub Jelinek

re PR c/35438 (ICE with invalid use of threadprivate)

	PR c/35438
	PR c/35439
	* c-parser.c (c_parser_omp_threadprivate): Don't add vars with
	errorneous type.  Check that v is a VAR_DECL.

	* gcc.dg/gomp/pr35438.c: New test.
	* gcc.dg/gomp/pr35439.c: New test.

From-SVN: r133085
parent 8b46837c
2008-03-10 Jakub Jelinek <jakub@redhat.com> 2008-03-10 Jakub Jelinek <jakub@redhat.com>
PR c/35438
PR c/35439
* c-parser.c (c_parser_omp_threadprivate): Don't add vars with
errorneous type. Check that v is a VAR_DECL.
PR middle-end/35099 PR middle-end/35099
* tree-cfg.c (new_label_mapper): Update cfun->last_label_uid. * tree-cfg.c (new_label_mapper): Update cfun->last_label_uid.
......
/* Parser for C and Objective-C. /* Parser for C and Objective-C.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Parser actions based on the old Bison parser; structure somewhat Parser actions based on the old Bison parser; structure somewhat
influenced by and fragments based on the C++ parser. influenced by and fragments based on the C++ parser.
...@@ -7964,10 +7965,14 @@ c_parser_omp_threadprivate (c_parser *parser) ...@@ -7964,10 +7965,14 @@ c_parser_omp_threadprivate (c_parser *parser)
/* If V had already been marked threadprivate, it doesn't matter /* If V had already been marked threadprivate, it doesn't matter
whether it had been used prior to this point. */ whether it had been used prior to this point. */
if (TREE_USED (v) && !C_DECL_THREADPRIVATE_P (v)) if (TREE_CODE (v) != VAR_DECL)
error ("%qD is not a variable", v);
else if (TREE_USED (v) && !C_DECL_THREADPRIVATE_P (v))
error ("%qE declared %<threadprivate%> after first use", v); error ("%qE declared %<threadprivate%> after first use", v);
else if (! TREE_STATIC (v) && ! DECL_EXTERNAL (v)) else if (! TREE_STATIC (v) && ! DECL_EXTERNAL (v))
error ("automatic variable %qE cannot be %<threadprivate%>", v); error ("automatic variable %qE cannot be %<threadprivate%>", v);
else if (TREE_TYPE (v) == error_mark_node)
;
else if (! COMPLETE_TYPE_P (TREE_TYPE (v))) else if (! COMPLETE_TYPE_P (TREE_TYPE (v)))
error ("%<threadprivate%> %qE has incomplete type", v); error ("%<threadprivate%> %qE has incomplete type", v);
else else
......
2008-03-10 Jakub Jelinek <jakub@redhat.com> 2008-03-10 Jakub Jelinek <jakub@redhat.com>
PR c/35438
PR c/35439
* gcc.dg/gomp/pr35438.c: New test.
* gcc.dg/gomp/pr35439.c: New test.
PR middle-end/35099 PR middle-end/35099
* g++.dg/gomp/pr35099.C: New test. * g++.dg/gomp/pr35099.C: New test.
/* PR c/35438 */
/* { dg-do compile } */
/* { dg-options "-fopenmp" } */
void foo ();
#pragma omp threadprivate(foo) /* { dg-error "is not a variable" } */
/* PR c/35439 */
/* { dg-do compile } */
/* { dg-options "-fopenmp" } */
void x[1]; /* { dg-error "array of voids" } */
#pragma omp threadprivate(x)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment