diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2023-09-12 09:19:04 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2023-09-12 09:19:04 +0200 |
commit | 35f498d8dfc8e579eaba2ff2d2b96769c632fd58 (patch) | |
tree | f3e2f5b948ee20d3990a57e8a137212e5df60530 /gcc/c/c-tree.h | |
parent | b90a4c3dd502974f352084c23a6cdfd767e1340b (diff) | |
download | gcc-35f498d8dfc8e579eaba2ff2d2b96769c632fd58.zip gcc-35f498d8dfc8e579eaba2ff2d2b96769c632fd58.tar.gz gcc-35f498d8dfc8e579eaba2ff2d2b96769c632fd58.tar.bz2 |
OpenMP (C only): omp allocate - extend parsing support, improve diagnostic
The 'allocate' directive can be used for both stack and static variables.
While the parser in C and C++ was pre-existing, it missed several
diagnostics, which this commit adds - for now only for C.
While the "sorry, unimplemented" for static variables is still issues
during parsing, the sorry for stack variables is now issued in the
middle end, preparing for the actual implementation. (Again: only for C.)
gcc/c/ChangeLog:
* c-parser.cc (c_parser_omp_construct): Move call to
c_parser_omp_allocate to ...
(c_parser_pragma): ... here.
(c_parser_omp_allocate): Avoid ICE is allocator could not be
parsed; set 'omp allocate' attribute for stack/automatic variables
and only reject static variables; add several additional
restriction checks.
* c-tree.h (c_mark_decl_jump_unsafe_in_current_scope): New prototype.
* c-decl.cc (decl_jump_unsafe): Return true for omp-allocated decls.
(c_mark_decl_jump_unsafe_in_current_scope): New.
(warn_about_goto, c_check_switch_jump_warnings): Add error for
omp-allocated decls.
gcc/ChangeLog:
* gimplify.cc (gimplify_bind_expr): Check for
insertion after variable cleanup. Convert 'omp allocate'
var-decl attribute to GOMP_alloc/GOMP_free calls.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/allocate-5.c: Fix testcase; make some
dg-messages for 'sorry' as c++, only.
* c-c++-common/gomp/directive-1.c: Make a 'sorry' c++ only.
* c-c++-common/gomp/allocate-9.c: New test.
* c-c++-common/gomp/allocate-11.c: New test.
* c-c++-common/gomp/allocate-12.c: New test.
* c-c++-common/gomp/allocate-14.c: New test.
* c-c++-common/gomp/allocate-15.c: New test.
* c-c++-common/gomp/allocate-16.c: New test.
Diffstat (limited to 'gcc/c/c-tree.h')
-rw-r--r-- | gcc/c/c-tree.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index f928137..2664354 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -626,6 +626,7 @@ extern unsigned int start_underspecified_init (location_t, tree); extern void finish_underspecified_init (tree, unsigned int); extern void push_scope (void); extern tree pop_scope (void); +extern void c_mark_decl_jump_unsafe_in_current_scope (); extern void c_bindings_start_stmt_expr (struct c_spot_bindings *); extern void c_bindings_end_stmt_expr (struct c_spot_bindings *); |