diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-02-02 12:42:10 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-02-02 12:42:10 -0800 |
commit | 8910f1cd79445bbe2da01f8ccf7c37909349529e (patch) | |
tree | ba67a346969358fd7cc2b7c12384479de8364cab /gcc/c | |
parent | 45c32be1f96ace25b66c34a84818dc5e07e9d516 (diff) | |
parent | 8e4a738d2540ab6aff77506d368bf4e3fa6963bd (diff) | |
download | gcc-8910f1cd79445bbe2da01f8ccf7c37909349529e.zip gcc-8910f1cd79445bbe2da01f8ccf7c37909349529e.tar.gz gcc-8910f1cd79445bbe2da01f8ccf7c37909349529e.tar.bz2 |
Merge from trunk revision 8e4a738d2540ab6aff77506d368bf4e3fa6963bd.
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 63 | ||||
-rw-r--r-- | gcc/c/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/c/c-aux-info.c | 2 | ||||
-rw-r--r-- | gcc/c/c-convert.c | 2 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 26 | ||||
-rw-r--r-- | gcc/c/c-errors.c | 2 | ||||
-rw-r--r-- | gcc/c/c-fold.c | 2 | ||||
-rw-r--r-- | gcc/c/c-lang.c | 2 | ||||
-rw-r--r-- | gcc/c/c-lang.h | 2 | ||||
-rw-r--r-- | gcc/c/c-objc-common.c | 2 | ||||
-rw-r--r-- | gcc/c/c-objc-common.h | 2 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 121 | ||||
-rw-r--r-- | gcc/c/c-parser.h | 2 | ||||
-rw-r--r-- | gcc/c/c-tree.h | 2 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 89 | ||||
-rw-r--r-- | gcc/c/config-lang.in | 2 | ||||
-rw-r--r-- | gcc/c/gccspec.c | 2 | ||||
-rw-r--r-- | gcc/c/gimple-parser.c | 9 | ||||
-rw-r--r-- | gcc/c/gimple-parser.h | 2 |
19 files changed, 294 insertions, 42 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index b97fb74..9afa103 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,64 @@ +2021-02-01 Martin Sebor <msebor@redhat.com> + + PR middle-end/97172 + * c-decl.c (free_attr_access_data): New function. + (c_parse_final_cleanups): Call free_attr_access_data. + +2021-01-16 Kwok Cheung Yeung <kcy@codesourcery.com> + + * c-parser.c (c_parser_omp_clause_detach): New. + (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH clause. + (OMP_TASK_CLAUSE_MASK): Add mask for PRAGMA_OMP_CLAUSE_DETACH. + * c-typeck.c (c_finish_omp_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH + clause. Prevent use of detach with mergeable and overriding the + data sharing mode of the event handle. + +2021-01-15 Jakub Jelinek <jakub@redhat.com> + + * c-typeck.c (c_finish_omp_clauses): For reduction build array with + unqualified element type and then call c_build_qualified_type on the + ARRAY_TYPE. + +2021-01-07 Richard Biener <rguenther@suse.de> + + * gimple-parser.c (c_parser_gimple_compound_statement): Only + reallocate loop array if it is too small. + +2020-12-16 Martin Uecker <muecker@gwdg.de> + + PR c/98047 + * c-typeck.c (build_modify_expr): Drop qualifiers. + +2020-12-16 Martin Uecker <muecker@gwdg.de> + + PR c/98260 + * c-parser.c (c_parser_expression): Look into + nop expression when marking expressions as read. + +2020-12-14 Martin Liska <mliska@suse.cz> + + PR sanitizer/98204 + * c-typeck.c (pointer_diff): Do not emit a top-level + sanitization. + (build_binary_op): Likewise. + +2020-12-09 Tobias Burnus <tobias@codesourcery.com> + + * c-parser.c (c_parser_omp_allocate): New. + (c_parser_omp_construct): Call it. + +2020-12-09 Richard Biener <rguenther@suse.de> + + PR c/98200 + * gimple-parser.c (c_parser_gimple_postfix_expression): Return + early on error. + +2020-12-07 Martin Uecker <muecker@gwdg.de> + + PR c/97981 + * c-typeck.c (convert_lvalue_to_rvalue): Move the code + that drops qualifiers to the end of the function. + 2020-11-26 Martin Uecker <muecker@gwdg.de> PR c/65455 @@ -7396,7 +7457,7 @@ * c-decl.c: Likewise. Include gt-c-c-decl.h, not gt-c-decl.h. * c-parser.c: Likewise. Include gt-c-c-parser.h, not gt-c-parser.h. -Copyright (C) 2012-2020 Free Software Foundation, Inc. +Copyright (C) 2012-2021 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in index 4b2e616..a1cdee8 100644 --- a/gcc/c/Make-lang.in +++ b/gcc/c/Make-lang.in @@ -1,5 +1,5 @@ # Top level -*- makefile -*- fragment for GNU C - C language. -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. #This file is part of GCC. diff --git a/gcc/c/c-aux-info.c b/gcc/c/c-aux-info.c index bdeef52..bae5757 100644 --- a/gcc/c/c-aux-info.c +++ b/gcc/c/c-aux-info.c @@ -1,7 +1,7 @@ /* Generate information regarding function declarations and definitions based on information stored in GCC's tree structure. This code implements the -aux-info option. - Copyright (C) 1989-2020 Free Software Foundation, Inc. + Copyright (C) 1989-2021 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@segfault.us.com). This file is part of GCC. diff --git a/gcc/c/c-convert.c b/gcc/c/c-convert.c index 8f0982d..d0035a3 100644 --- a/gcc/c/c-convert.c +++ b/gcc/c/c-convert.c @@ -1,5 +1,5 @@ /* Language-level data type conversion for GNU C. - Copyright (C) 1987-2020 Free Software Foundation, Inc. + Copyright (C) 1987-2021 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 27f7722..be95643 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -1,5 +1,5 @@ /* Process declarations and variables for C compiler. - Copyright (C) 1988-2020 Free Software Foundation, Inc. + Copyright (C) 1988-2021 Free Software Foundation, Inc. This file is part of GCC. @@ -12146,6 +12146,27 @@ collect_source_refs (void) collect_source_ref (DECL_SOURCE_FILE (decl)); } +/* Free attribute access data that are not needed by the middle end. */ + +static void +free_attr_access_data () +{ + struct cgraph_node *n; + + /* Iterate over all functions declared in the translation unit. */ + FOR_EACH_FUNCTION (n) + { + tree fntype = TREE_TYPE (n->decl); + if (!fntype) + continue; + tree attrs = TYPE_ATTRIBUTES (fntype); + if (!attrs) + continue; + + attr_access::free_lang_data (attrs); + } +} + /* Perform any final parser cleanups and generate initial debugging information. */ @@ -12190,6 +12211,9 @@ c_parse_final_cleanups (void) c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_1 (BLOCK_VARS (ext_block)); + if (!in_lto_p) + free_attr_access_data (); + timevar_stop (TV_PHASE_DEFERRED); timevar_start (TV_PHASE_PARSING); diff --git a/gcc/c/c-errors.c b/gcc/c/c-errors.c index d90587c..de98958 100644 --- a/gcc/c/c-errors.c +++ b/gcc/c/c-errors.c @@ -1,5 +1,5 @@ /* Various diagnostic subroutines for the GNU C language. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. Contributed by Gabriel Dos Reis <gdr@codesourcery.com> This file is part of GCC. diff --git a/gcc/c/c-fold.c b/gcc/c/c-fold.c index bd21d24..68c74cc 100644 --- a/gcc/c/c-fold.c +++ b/gcc/c/c-fold.c @@ -1,5 +1,5 @@ /* Support for fully folding sub-trees of an expression for C compiler. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c/c-lang.c b/gcc/c/c-lang.c index 5d52c42..778a6f2 100644 --- a/gcc/c/c-lang.c +++ b/gcc/c/c-lang.c @@ -1,5 +1,5 @@ /* Language-specific hook definitions for C front end. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c/c-lang.h b/gcc/c/c-lang.h index 7e9a276..2f62ee1 100644 --- a/gcc/c/c-lang.h +++ b/gcc/c/c-lang.h @@ -1,5 +1,5 @@ /* Definitions for C language specific types. - Copyright (C) 2009-2020 Free Software Foundation, Inc. + Copyright (C) 2009-2021 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c/c-objc-common.c b/gcc/c/c-objc-common.c index 378288f..a68249d 100644 --- a/gcc/c/c-objc-common.c +++ b/gcc/c/c-objc-common.c @@ -1,5 +1,5 @@ /* Some code common to C and ObjC front ends. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c/c-objc-common.h b/gcc/c/c-objc-common.h index 76f9db7..7d35a06 100644 --- a/gcc/c/c-objc-common.h +++ b/gcc/c/c-objc-common.h @@ -1,5 +1,5 @@ /* Language hooks common to C and ObjC front ends. - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. Contributed by Ziemowit Laski <zlaski@apple.com> This file is part of GCC. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 87ee8f4..a8df208 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -1,5 +1,5 @@ /* Parser for C and Objective-C. - Copyright (C) 1987-2020 Free Software Foundation, Inc. + Copyright (C) 1987-2021 Free Software Foundation, Inc. Parser actions based on the old Bison parser; structure somewhat influenced by and fragments based on the C++ parser. @@ -10615,8 +10615,14 @@ c_parser_expression (c_parser *parser) c_parser_consume_token (parser); expr_loc = c_parser_peek_token (parser)->location; lhsval = expr.value; - while (TREE_CODE (lhsval) == COMPOUND_EXPR) - lhsval = TREE_OPERAND (lhsval, 1); + while (TREE_CODE (lhsval) == COMPOUND_EXPR + || TREE_CODE (lhsval) == NOP_EXPR) + { + if (TREE_CODE (lhsval) == COMPOUND_EXPR) + lhsval = TREE_OPERAND (lhsval, 1); + else + lhsval = TREE_OPERAND (lhsval, 0); + } if (DECL_P (lhsval) || handled_component_p (lhsval)) mark_exp_read (lhsval); next = c_parser_expr_no_commas (parser, NULL); @@ -15971,6 +15977,56 @@ c_parser_omp_clause_uniform (c_parser *parser, tree list) return list; } +/* OpenMP 5.0: + detach ( event-handle ) */ + +static tree +c_parser_omp_clause_detach (c_parser *parser, tree list) +{ + matching_parens parens; + location_t clause_loc = c_parser_peek_token (parser)->location; + + if (!parens.require_open (parser)) + return list; + + if (c_parser_next_token_is_not (parser, CPP_NAME) + || c_parser_peek_token (parser)->id_kind != C_ID_ID) + { + c_parser_error (parser, "expected identifier"); + parens.skip_until_found_close (parser); + return list; + } + + tree t = lookup_name (c_parser_peek_token (parser)->value); + if (t == NULL_TREE) + { + undeclared_variable (c_parser_peek_token (parser)->location, + c_parser_peek_token (parser)->value); + parens.skip_until_found_close (parser); + return list; + } + c_parser_consume_token (parser); + + tree type = TYPE_MAIN_VARIANT (TREE_TYPE (t)); + if (!INTEGRAL_TYPE_P (type) + || TREE_CODE (type) != ENUMERAL_TYPE + || TYPE_NAME (type) != get_identifier ("omp_event_handle_t")) + { + error_at (clause_loc, "%<detach%> clause event handle " + "has type %qT rather than " + "%<omp_event_handle_t%>", + type); + parens.skip_until_found_close (parser); + return list; + } + + tree u = build_omp_clause (clause_loc, OMP_CLAUSE_DETACH); + OMP_CLAUSE_DECL (u) = t; + OMP_CLAUSE_CHAIN (u) = list; + parens.skip_until_found_close (parser); + return u; +} + /* Parse all OpenACC clauses. The set clauses allowed by the directive is a bitmask in MASK. Return the list of clauses found. */ @@ -16237,6 +16293,10 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask, clauses = c_parser_omp_clause_default (parser, clauses, false); c_name = "default"; break; + case PRAGMA_OMP_CLAUSE_DETACH: + clauses = c_parser_omp_clause_detach (parser, clauses); + c_name = "detach"; + break; case PRAGMA_OMP_CLAUSE_FIRSTPRIVATE: clauses = c_parser_omp_clause_firstprivate (parser, clauses); c_name = "firstprivate"; @@ -17250,6 +17310,55 @@ c_parser_oacc_wait (location_t loc, c_parser *parser, char *p_name) return stmt; } +/* OpenMP 5.0: + # pragma omp allocate (list) [allocator(allocator)] */ + +static void +c_parser_omp_allocate (location_t loc, c_parser *parser) +{ + tree allocator = NULL_TREE; + tree nl = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_ALLOCATE, NULL_TREE); + if (c_parser_next_token_is (parser, CPP_NAME)) + { + matching_parens parens; + const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value); + c_parser_consume_token (parser); + if (strcmp ("allocator", p) != 0) + error_at (c_parser_peek_token (parser)->location, + "expected %<allocator%>"); + else if (parens.require_open (parser)) + { + location_t expr_loc = c_parser_peek_token (parser)->location; + c_expr expr = c_parser_expr_no_commas (parser, NULL); + expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true); + allocator = expr.value; + allocator = c_fully_fold (allocator, false, NULL); + tree orig_type + = expr.original_type ? expr.original_type : TREE_TYPE (allocator); + orig_type = TYPE_MAIN_VARIANT (orig_type); + if (!INTEGRAL_TYPE_P (TREE_TYPE (allocator)) + || TREE_CODE (orig_type) != ENUMERAL_TYPE + || TYPE_NAME (orig_type) + != get_identifier ("omp_allocator_handle_t")) + { + error_at (expr_loc, "%<allocator%> clause allocator expression " + "has type %qT rather than " + "%<omp_allocator_handle_t%>", + TREE_TYPE (allocator)); + allocator = NULL_TREE; + } + parens.skip_until_found_close (parser); + } + } + c_parser_skip_to_pragma_eol (parser); + + if (allocator) + for (tree c = nl; c != NULL_TREE; c = OMP_CLAUSE_CHAIN (c)) + OMP_CLAUSE_ALLOCATE_ALLOCATOR (c) = allocator; + + sorry_at (loc, "%<#pragma omp allocate%> not yet supported"); +} + /* OpenMP 2.5: # pragma omp atomic new-line expression-stmt @@ -19135,7 +19244,8 @@ c_parser_omp_single (location_t loc, c_parser *parser, bool *if_p) | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEPEND) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIORITY) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \ - | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IN_REDUCTION)) + | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IN_REDUCTION) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DETACH)) static tree c_parser_omp_task (location_t loc, c_parser *parser, bool *if_p) @@ -21537,6 +21647,9 @@ c_parser_omp_construct (c_parser *parser, bool *if_p) strcpy (p_name, "#pragma wait"); stmt = c_parser_oacc_wait (loc, parser, p_name); break; + case PRAGMA_OMP_ALLOCATE: + c_parser_omp_allocate (loc, parser); + return; case PRAGMA_OMP_ATOMIC: c_parser_omp_atomic (loc, parser, false); return; diff --git a/gcc/c/c-parser.h b/gcc/c/c-parser.h index bf9e75e..773aa43 100644 --- a/gcc/c/c-parser.h +++ b/gcc/c/c-parser.h @@ -1,5 +1,5 @@ /* Declarations for the parser for C and Objective-C. - Copyright (C) 1987-2020 Free Software Foundation, Inc. + Copyright (C) 1987-2021 Free Software Foundation, Inc. Parser actions based on the old Bison parser; structure somewhat influenced by and fragments based on the C++ parser. diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index 1f783db..a671a3e 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -1,5 +1,5 @@ /* Definitions for C parsing and type checking. - Copyright (C) 1987-2020 Free Software Foundation, Inc. + Copyright (C) 1987-2021 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index cdc491a..8ef0843 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -1,5 +1,5 @@ /* Build expressions with type checking for C compiler. - Copyright (C) 1987-2020 Free Software Foundation, Inc. + Copyright (C) 1987-2021 Free Software Foundation, Inc. This file is part of GCC. @@ -2080,9 +2080,6 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, exp = default_function_array_conversion (loc, exp); if (!VOID_TYPE_P (TREE_TYPE (exp.value))) exp.value = require_complete_type (loc, exp.value); - if (convert_p && !error_operand_p (exp.value) - && (TREE_CODE (TREE_TYPE (exp.value)) != ARRAY_TYPE)) - exp.value = convert (build_qualified_type (TREE_TYPE (exp.value), TYPE_UNQUALIFIED), exp.value); if (really_atomic_lvalue (exp.value)) { vec<tree, va_gc> *params; @@ -2119,6 +2116,9 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, exp.value = build4 (TARGET_EXPR, nonatomic_type, tmp, func_call, NULL_TREE, NULL_TREE); } + if (convert_p && !error_operand_p (exp.value) + && (TREE_CODE (TREE_TYPE (exp.value)) != ARRAY_TYPE)) + exp.value = convert (build_qualified_type (TREE_TYPE (exp.value), TYPE_UNQUALIFIED), exp.value); return exp; } @@ -3949,10 +3949,9 @@ pointer_diff (location_t loc, tree op0, tree op1, tree *instrument_expr) pedwarn (loc, OPT_Wpointer_arith, "pointer to a function used in subtraction"); - if (sanitize_flags_p (SANITIZE_POINTER_SUBTRACT)) + if (current_function_decl != NULL_TREE + && sanitize_flags_p (SANITIZE_POINTER_SUBTRACT)) { - gcc_assert (current_function_decl != NULL_TREE); - op0 = save_expr (op0); op1 = save_expr (op1); @@ -6276,16 +6275,9 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype, "enum conversion in assignment is invalid in C++"); } - /* If the lhs is atomic, remove that qualifier. */ - if (is_atomic_op) - { - lhstype = build_qualified_type (lhstype, - (TYPE_QUALS (lhstype) - & ~TYPE_QUAL_ATOMIC)); - olhstype = build_qualified_type (olhstype, - (TYPE_QUALS (lhstype) - & ~TYPE_QUAL_ATOMIC)); - } + /* Remove qualifiers. */ + lhstype = build_qualified_type (lhstype, TYPE_UNQUALIFIED); + olhstype = build_qualified_type (olhstype, TYPE_UNQUALIFIED); /* Convert new value to destination type. Fold it first, then restore any excess precision information, for the sake of @@ -12324,6 +12316,7 @@ build_binary_op (location_t location, enum tree_code code, } if ((code0 == POINTER_TYPE || code1 == POINTER_TYPE) + && current_function_decl != NULL_TREE && sanitize_flags_p (SANITIZE_POINTER_COMPARE)) { op0 = save_expr (op0); @@ -13861,6 +13854,8 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) tree simdlen = NULL_TREE, safelen = NULL_TREE; bool branch_seen = false; bool copyprivate_seen = false; + bool mergeable_seen = false; + tree *detach_seen = NULL; bool linear_variable_step_check = false; tree *nowait_clause = NULL; tree ordered_clause = NULL_TREE; @@ -13986,7 +13981,9 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) size = size_binop (MINUS_EXPR, size, size_one_node); size = save_expr (size); tree index_type = build_index_type (size); - tree atype = build_array_type (type, index_type); + tree atype = build_array_type (TYPE_MAIN_VARIANT (type), + index_type); + atype = c_build_qualified_type (atype, TYPE_QUALS (type)); tree ptype = build_pointer_type (type); if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) t = build_fold_addr_expr (t); @@ -14942,6 +14939,21 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) pc = &OMP_CLAUSE_CHAIN (c); continue; + case OMP_CLAUSE_DETACH: + t = OMP_CLAUSE_DECL (c); + if (detach_seen) + { + error_at (OMP_CLAUSE_LOCATION (c), + "too many %qs clauses on a task construct", + "detach"); + remove = true; + break; + } + detach_seen = pc; + pc = &OMP_CLAUSE_CHAIN (c); + c_mark_addressable (t); + continue; + case OMP_CLAUSE_IF: case OMP_CLAUSE_NUM_THREADS: case OMP_CLAUSE_NUM_TEAMS: @@ -14950,7 +14962,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) case OMP_CLAUSE_UNTIED: case OMP_CLAUSE_COLLAPSE: case OMP_CLAUSE_FINAL: - case OMP_CLAUSE_MERGEABLE: case OMP_CLAUSE_DEVICE: case OMP_CLAUSE_DIST_SCHEDULE: case OMP_CLAUSE_PARALLEL: @@ -14984,6 +14995,11 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) pc = &OMP_CLAUSE_CHAIN (c); continue; + case OMP_CLAUSE_MERGEABLE: + mergeable_seen = true; + pc = &OMP_CLAUSE_CHAIN (c); + continue; + case OMP_CLAUSE_NOGROUP: nogroup_seen = pc; pc = &OMP_CLAUSE_CHAIN (c); @@ -15235,6 +15251,41 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) *nogroup_seen = OMP_CLAUSE_CHAIN (*nogroup_seen); } + if (detach_seen) + { + if (mergeable_seen) + { + error_at (OMP_CLAUSE_LOCATION (*detach_seen), + "%<detach%> clause must not be used together with " + "%<mergeable%> clause"); + *detach_seen = OMP_CLAUSE_CHAIN (*detach_seen); + } + else + { + tree detach_decl = OMP_CLAUSE_DECL (*detach_seen); + + for (pc = &clauses, c = clauses; c ; c = *pc) + { + bool remove = false; + if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED + || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_PRIVATE + || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE + || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE) + && OMP_CLAUSE_DECL (c) == detach_decl) + { + error_at (OMP_CLAUSE_LOCATION (c), + "the event handle of a %<detach%> clause " + "should not be in a data-sharing clause"); + remove = true; + } + if (remove) + *pc = OMP_CLAUSE_CHAIN (c); + else + pc = &OMP_CLAUSE_CHAIN (c); + } + } + } + bitmap_obstack_release (NULL); return clauses; } diff --git a/gcc/c/config-lang.in b/gcc/c/config-lang.in index 57578bb..b9cf5f3 100644 --- a/gcc/c/config-lang.in +++ b/gcc/c/config-lang.in @@ -1,5 +1,5 @@ # Top level configure fragment for GNU C - C language. -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. #This file is part of GCC. diff --git a/gcc/c/gccspec.c b/gcc/c/gccspec.c index 93136b4..db353a3 100644 --- a/gcc/c/gccspec.c +++ b/gcc/c/gccspec.c @@ -1,5 +1,5 @@ /* Specific flags and argument handling of the C front-end. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index 5c0ed82..58b161b 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -1,5 +1,5 @@ /* Parser for GIMPLE. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of GCC. @@ -616,8 +616,9 @@ c_parser_gimple_compound_statement (gimple_parser &parser, gimple_seq *seq) class loop *loop = alloc_loop (); loop->num = is_loop_header_of; loop->header = bb; - vec_safe_grow_cleared (loops_for_fn (cfun)->larray, - is_loop_header_of + 1, true); + if (number_of_loops (cfun) <= (unsigned)is_loop_header_of) + vec_safe_grow_cleared (loops_for_fn (cfun)->larray, + is_loop_header_of + 1, true); (*loops_for_fn (cfun)->larray)[is_loop_header_of] = loop; flow_loop_tree_node_add (loops_for_fn (cfun)->tree_root, loop); @@ -1700,6 +1701,8 @@ c_parser_gimple_postfix_expression (gimple_parser &parser) expr.set_error (); break; } + if (expr.value == error_mark_node) + return expr; return c_parser_gimple_postfix_expression_after_primary (parser, EXPR_LOC_OR_LOC (expr.value, loc), expr); } diff --git a/gcc/c/gimple-parser.h b/gcc/c/gimple-parser.h index f3af1b0..6501bcf 100644 --- a/gcc/c/gimple-parser.h +++ b/gcc/c/gimple-parser.h @@ -1,5 +1,5 @@ /* Declarations for the parser for GIMPLE. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of GCC. |