diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-10-27 08:47:25 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-10-27 08:47:25 -0700 |
commit | a6d3012b274f38b20e2a57162106f625746af6c6 (patch) | |
tree | 09ff8b13eb8ff7594c27dc8812efbf696dc97484 /gcc/c | |
parent | cd2fd5facb5e1882d3f338ed456ae9536f7c0593 (diff) | |
parent | 99b1021d21e5812ed01221d8fca8e8a32488a934 (diff) | |
download | gcc-a6d3012b274f38b20e2a57162106f625746af6c6.zip gcc-a6d3012b274f38b20e2a57162106f625746af6c6.tar.gz gcc-a6d3012b274f38b20e2a57162106f625746af6c6.tar.bz2 |
Merge from trunk revision 99b1021d21e5812ed01221d8fca8e8a32488a934.
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 24 | ||||
-rw-r--r-- | gcc/c/Make-lang.in | 1 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 41 | ||||
-rw-r--r-- | gcc/c/gimple-parser.c | 8 |
4 files changed, 68 insertions, 6 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index c5f5575..08ef6ae 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,27 @@ +2021-10-22 Eric Gallager <egallager@gcc.gnu.org> + + PR other/102663 + * Make-lang.in: Add dummy c.install-dvi target. + +2021-10-15 Richard Biener <rguenther@suse.de> + + PR c/102763 + * gimple-parser.c + (c_parser_gimple_postfix_expression_after_primary): Check + for a pointer do be dereferenced by ->. + +2021-10-14 Kwok Cheung Yeung <kcy@codesourcery.com> + + * c-parser.c (c_finish_omp_declare_variant): Change call from + c_omp_check_context_selector to omp_check_context_selector. Change + call from c_omp_mark_declare_variant to omp_mark_declare_variant. + +2021-10-09 Jakub Jelinek <jakub@redhat.com> + + * c-parser.c (c_parser_omp_structured_block_sequence): New function. + (c_parser_omp_scan_loop_body): Use it. + (c_parser_omp_sections_scope): Likewise. + 2021-10-07 Richard Biener <rguenther@suse.de> * c-typeck.c (lvalue_p): Also allow MEM_REF and TARGET_MEM_REF. diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in index a1cdee8..67a40fc 100644 --- a/gcc/c/Make-lang.in +++ b/gcc/c/Make-lang.in @@ -99,6 +99,7 @@ c.dvi: c.pdf: c.html: c.install-info: +c.install-dvi: c.install-pdf: c.install-html: c.all.cross: diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index a66f43f..80dd61d 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -18976,6 +18976,31 @@ c_parser_omp_flush (c_parser *parser) c_finish_omp_flush (loc, mo); } +/* Parse an OpenMP structured block sequence. KIND is the corresponding + separating directive. */ + +static tree +c_parser_omp_structured_block_sequence (c_parser *parser, + enum pragma_kind kind) +{ + tree stmt = push_stmt_list (); + c_parser_statement (parser, NULL); + do + { + if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE)) + break; + if (c_parser_next_token_is (parser, CPP_EOF)) + break; + + if (kind != PRAGMA_NONE + && c_parser_peek_token (parser)->pragma_kind == kind) + break; + c_parser_statement (parser, NULL); + } + while (1); + return pop_stmt_list (stmt); +} + /* OpenMP 5.0: scan-loop-body: @@ -18997,7 +19022,7 @@ c_parser_omp_scan_loop_body (c_parser *parser, bool open_brace_parsed) return; } - substmt = c_parser_omp_structured_block (parser, NULL); + substmt = c_parser_omp_structured_block_sequence (parser, PRAGMA_OMP_SCAN); substmt = build2 (OMP_SCAN, void_type_node, substmt, NULL_TREE); SET_EXPR_LOCATION (substmt, loc); add_stmt (substmt); @@ -19032,7 +19057,7 @@ c_parser_omp_scan_loop_body (c_parser *parser, bool open_brace_parsed) error ("expected %<#pragma omp scan%>"); clauses = c_finish_omp_clauses (clauses, C_ORT_OMP); - substmt = c_parser_omp_structured_block (parser, NULL); + substmt = c_parser_omp_structured_block_sequence (parser, PRAGMA_NONE); substmt = build2 (OMP_SCAN, void_type_node, substmt, clauses); SET_EXPR_LOCATION (substmt, loc); add_stmt (substmt); @@ -19860,6 +19885,8 @@ c_parser_omp_ordered (c_parser *parser, enum pragma_context context, section-directive[opt] structured-block section-sequence section-directive structured-block + OpenMP 5.1 allows structured-block-sequence instead of structured-block. + SECTIONS_LOC is the location of the #pragma omp sections. */ static tree @@ -19881,7 +19908,8 @@ c_parser_omp_sections_scope (location_t sections_loc, c_parser *parser) if (c_parser_peek_token (parser)->pragma_kind != PRAGMA_OMP_SECTION) { - substmt = c_parser_omp_structured_block (parser, NULL); + substmt = c_parser_omp_structured_block_sequence (parser, + PRAGMA_OMP_SECTION); substmt = build1 (OMP_SECTION, void_type_node, substmt); SET_EXPR_LOCATION (substmt, loc); add_stmt (substmt); @@ -19907,7 +19935,8 @@ c_parser_omp_sections_scope (location_t sections_loc, c_parser *parser) error_suppress = true; } - substmt = c_parser_omp_structured_block (parser, NULL); + substmt = c_parser_omp_structured_block_sequence (parser, + PRAGMA_OMP_SECTION); substmt = build1 (OMP_SECTION, void_type_node, substmt); SET_EXPR_LOCATION (substmt, loc); add_stmt (substmt); @@ -21665,7 +21694,7 @@ c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms) tree ctx = c_parser_omp_context_selector_specification (parser, parms); if (ctx == error_mark_node) goto fail; - ctx = c_omp_check_context_selector (match_loc, ctx); + ctx = omp_check_context_selector (match_loc, ctx); if (ctx != error_mark_node && variant != error_mark_node) { if (TREE_CODE (variant) != FUNCTION_DECL) @@ -21695,7 +21724,7 @@ c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms) { C_DECL_USED (variant) = 1; tree construct = omp_get_context_selector (ctx, "construct", NULL); - c_omp_mark_declare_variant (match_loc, variant, construct); + omp_mark_declare_variant (match_loc, variant, construct); if (omp_context_selector_matches (ctx)) { tree attr diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index c43ee38..f3d9935 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -1817,6 +1817,14 @@ c_parser_gimple_postfix_expression_after_primary (gimple_parser &parser, case CPP_DEREF: { /* Structure element reference. */ + if (!POINTER_TYPE_P (TREE_TYPE (expr.value))) + { + c_parser_error (parser, "dereference of non-pointer"); + expr.set_error (); + expr.original_code = ERROR_MARK; + expr.original_type = NULL; + return expr; + } c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_NAME)) { |