diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2025-04-09 08:21:19 +0200 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2025-04-09 08:21:19 +0200 |
commit | 2d7e1d6e40a13a5f160b584336795b80f193ec3b (patch) | |
tree | beeb5256dd903907a5c3b257207e25065fe1a082 /gcc/fortran/trans.h | |
parent | 94438ca82792063abf05823326695af25ab02d17 (diff) | |
download | gcc-2d7e1d6e40a13a5f160b584336795b80f193ec3b.zip gcc-2d7e1d6e40a13a5f160b584336795b80f193ec3b.tar.gz gcc-2d7e1d6e40a13a5f160b584336795b80f193ec3b.tar.bz2 |
Fortran: Add code gen for do,concurrent's LOCAL/LOCAL_INIT [PR101602]
Implement LOCAL and LOCAL_INIT; we locally replace the tree declaration by
a local declaration of the outer variable. The 'local_init' then assigns
the value at the beginning of each loop iteration from the outer
declaration.
Note that the current implementation does not handle LOCAL with types that
have a default initializer and LOCAL/LOCAL_INIT for assumed-shape arrays;
this is diagnosed with a sorry error.
PR fortran/101602
gcc/fortran/ChangeLog:
* resolve.cc (resolve_locality_spec): Remove 'sorry, unimplemented'.
* trans-stmt.cc (struct symbol_and_tree_t): New.
(gfc_trans_concurrent_locality_spec): New.
(gfc_trans_forall_1): Call it; update to handle local and local_init.
* trans-decl.cc (gfc_start_saved_local_decls,
gfc_stop_saved_local_decls): New; moved code from ...
(gfc_process_block_locals): ... here. Call it.
* trans.h (gfc_start_saved_local_decls,
gfc_stop_saved_local_decls): Declare.
gcc/testsuite/ChangeLog:
* gfortran.dg/do_concurrent_8_f2023.f90: Update for removed 'sorry,
unimplemented'.
* gfortran.dg/do_concurrent_9.f90: Likewise.
* gfortran.dg/do_concurrent_all_clauses.f90: Likewise.
* gfortran.dg/do_concurrent_local_init.f90: Likewise.
* gfortran.dg/do_concurrent_locality_specs.f90: Likewise.
* gfortran.dg/do_concurrent_11.f90: New test.
* gfortran.dg/do_concurrent_12.f90: New test.
* gfortran.dg/do_concurrent_13.f90: New test.
* gfortran.dg/do_concurrent_14.f90: New test.
* gfortran.dg/do_concurrent_15.f90: New test.
Diffstat (limited to 'gcc/fortran/trans.h')
-rw-r--r-- | gcc/fortran/trans.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 69c3d90..63a566a 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -804,6 +804,8 @@ tree gfc_build_library_function_decl_with_spec (tree name, const char *spec, tree rettype, int nargs, ...); /* Process the local variable decls of a block construct. */ +void gfc_start_saved_local_decls (); +void gfc_stop_saved_local_decls (); void gfc_process_block_locals (gfc_namespace*); /* Output initialization/clean-up code that was deferred. */ |