diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-03-10 20:40:39 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-03-10 20:40:39 +0100 |
commit | 5df27e4a3eceb7ec1a69108e5be6cc918dee846b (patch) | |
tree | 76440d4144015b3e095e8ad13bdb9593ffeb0b3c /gcc/c-parser.c | |
parent | 8b46837cd1feb7d5f9d7c01b28ddb2b4d3ee455e (diff) | |
download | gcc-5df27e4a3eceb7ec1a69108e5be6cc918dee846b.zip gcc-5df27e4a3eceb7ec1a69108e5be6cc918dee846b.tar.gz gcc-5df27e4a3eceb7ec1a69108e5be6cc918dee846b.tar.bz2 |
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
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 1e63c14..831f95a 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -1,6 +1,7 @@ /* Parser for C and Objective-C. 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 influenced by and fragments based on the C++ parser. @@ -7964,10 +7965,14 @@ c_parser_omp_threadprivate (c_parser *parser) /* If V had already been marked threadprivate, it doesn't matter 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); else if (! TREE_STATIC (v) && ! DECL_EXTERNAL (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))) error ("%<threadprivate%> %qE has incomplete type", v); else |