Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
gcc/fortran/ChangeLog:
* trans-array.c (gfc_conv_ss_descriptor): Use correct ref.
* trans-intrinsic.c (trans_argument): Use gfc_conv_expr_reference.
* trans-decl.c (gfc_build_builtin_function_decls):
Correct spec for array.
libgfortran/ChangeLog:
* caf_shared/collective_subroutine.c (collsub_reduce_array):
Fix off by one error for result.
gcc/testsuite/ChangeLog:
* gfortran.dg/caf-shared/co_reduce_1.f90: New test.
|
|
|
|
This makes STAT and ERRMSG work on ALLOCATE. It also separates
the allocation of coarrays into two functions: One without error
checking, which is called by compiler-generated code, and one
with error checking for call from user code.
In the course of looking at this, it was also noticed that
allocatable coarrays were not automatically deallocated;
this is now also fixed. Also, saved allocatable coarrays
are now saved.
gcc/fortran/ChangeLog:
* trans-array.c (gfc_allocate_shared_coarray): Remove extra
arguments, just build the call.
(allocate_shared_coarray_chk): New function.
(gfc_array_allocate): Adjust where to set the offset.
Error handling is done in the library for shared coarrays.
(gfc_trans_deferred_array): No early return for allocatable
shared coarrays.
* trans-array.h (gfc_array_allocate): Adjust prototype.
(gfc_allocate_shared_coarray): Likewise.
* trans-decl.c: Rename gfor_fndecl_cas_coarray_allocate to
gfor_fndecl_cas_coarray_alloc for
brevity. Add gfor_fndecl_cas_coarray_alloc_chk.
(gfc_build_builtin_function_decls): Likewise.
(gfc_trans_shared_coarray): Adjust calling sequence for
gfc_allocate_shared_coarray.
(gfc_trans_deferred_vars): Correct handling of saved
allocatable shared coarrays.
* trans-stmt.c (gfc_trans_sync): Adjust whitespace.o
(coarray_alloc_p): Remove.
(gfc_trans_allocate): Add shared_coarray variable to adjust
status and errmsg handling.
* trans.h: Rename gfor_fndecl_cas_coarray_allocate to
gfor_fndecl_cas_coarray_alloc for brevity. Add
gfor_fndecl_cas_coarray_alloc_chk.
libgfortran/ChangeLog:
* caf_shared/coarraynative.c (test_for_cas_errors): Correct
handling of stat.
* caf_shared/libcoarraynative.h (STAT_ERRMSG_ENTRY_CHECK): Use
unlikely in condition.
(STAT_ERRMSG_ENTRY_CHECK_RET): Likewise.
* caf_shared/wrapper.c (cas_coarray_alloc): Adjust arguments.
Call cas_coarray_alloc_work.
(cas_coarray_alloc_chk): New function.
(cas_coarray_alloc_work): New function.
gcc/testsuite/ChangeLog:
* gfortran.dg/caf-shared/allocate_1.f90: Adjust number of calls to
sync_all.
* gfortran.dg/caf-shared/allocate_status_1.f90: New test.
* gfortran.dg/caf-shared/automatic_deallocate_1.f90: New test.
* gfortran.dg/caf-shared/save_allocatable_1.f90: New test.
|
|
|
|
2020-12-29 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/97612
* primary.c (build_actual_constructor): Missing allocatable
components are set unallocated using EXPR_NULL. Then missing
components are tested for a default initializer.
gcc/testsuite/
PR fortran/97612
* gfortran.dg/structure_constructor_17.f90: New test.
|
|
2020-12-29 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/93833
* trans-array.c (get_array_ctor_var_strlen): If the character
length backend_decl cannot be found, convert the expression and
use the string length. Clear up some minor white space issues
in the rest of the file.
gcc/testsuite/
PR fortran/93833
* gfortran.dg/deferred_character_36.f90 : New test.
|
|
|
|
gcc/fortran/ChangeLog:
* trans-array.c (gfc_conv_array_ref): Before discarding offset,
check if this is a coarray and we are building shared coarrays.
* trans-decl.c (gfc_build_builtin_function_decls): Clear up
types for cas_coarray_allocate.
(gfc_trans_shared_coarray): Pass NULL_TREEs to status and
errmsg.
libgfortran/ChangeLog:
* caf_shared/util.h (CAS_DEBUG_PR): New macro.
gcc/testsuite/ChangeLog:
* gfortran.dg/caf-shared/cas.exp: Add -g to debug flags to allow
better backtrace.
|
|
2020-12-27 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/97694
PR fortran/97723
* check.c (allocatable_check): Select rank temporaries are
permitted even though they are treated as associate variables.
* resolve.c (gfc_resolve_code): Break on select rank as well as
select type so that the block os resolved.
* trans-stmt.c (trans_associate_var): Class associate variables
that are optional dummies must use the backend_decl.
gcc/testsuite/
PR fortran/97694
PR fortran/97723
* gfortran.dg/select_rank_5.f90: New test.
|
|
|
|
2020-12-26 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/98022
* data.c (gfc_assign_data_value): Throw an error for inquiry
references. Follow with corrected code that would provide the
expected result and provides clean error recovery.
gcc/testsuite/
PR fortran/98022
* gfortran.dg/data_inquiry_ref.f90: Change to dg-compile and
add errors for inquiry references.
|
|
2020-12-23 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/83118
* trans-array.c (gfc_alloc_allocatable_for_assignment): Make
sure that class expressions are captured for dummy arguments by
use of gfc_get_class_from_gfc_expr otherwise the wrong vptr is
used.
* trans-expr.c (gfc_get_class_from_gfc_expr): New function.
(gfc_get_class_from_expr): If a constant expression is
encountered, return NULL_TREE;
(gfc_trans_assignment_1): Deallocate rhs allocatable components
after passing derived type function results to class lhs.
* trans.h : Add prototype for gfc_get_class_from_gfc_expr.
|
|
|
|
Fix handling of F2018 enhancements to DATA statements that allows
initialization of pointer components to derived types, and adjust error
handling for the CHARACTER case.
gcc/fortran/ChangeLog:
* data.c (gfc_assign_data_value): Restrict use of
create_character_initializer to constant initializers.
* trans-expr.c (gfc_conv_initializer): Ensure that character
initializer is constant, otherwise fall through to get the same
error handling as for non-character cases.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr93685_1.f90: New test.
* gfortran.dg/pr93685_2.f90: New test.
|
|
This adds the calculation of the offset for allocatable coarrays,
which was missing before, and fixes the resulting fallout for
ALLOCATED. Additionally, it prepares the way for STAT and ERRMSG
for ALLOCATE of coarrays, but that still needs changes to
gfc_trans_allocate.
gcc/fortran/ChangeLog:
* trans-array.c (gfc_conv_array_ref): If se->address_only is set,
throw away all the offset calculation.
(gfc_allocate_shared_coarray): Add arguments stat, errmsg and
errlen to call to allocate. Calculate offset for allocatable
coarrays.
(gfc_array_allocate): Adjust call to gfc_allocate_shared_coarray.
* trans-array.h (gfc_allocate_shared_coarray): Change prototype
of cas_coarray_alloc.
* trans-decl.c (gfc_build_builtin_function_decls): Adjust
cas_coarray_alloc to changed prototypes.
(gfc_trans_shared_coarray): Adjust call to gfc_allocate_shared_coarray.
* trans-intrinsic.c (gfc_conv_allocated): Set address_only on se.
* trans.h: Add flag address_only to gfc_se.
libgfortran/ChangeLog:
* caf_shared/wrapper.c (cas_coarray_alloc): Add status, error and
errmsg arguments and their checking.
|
|
|
|
gcc/fortran/ChangeLog:
* trans-array.c (gfc_conv_array_ref): Whitespace fix. Do not
add offset if se->no_impl_this_image is set.
* trans-intrinsic.c (gfc_conv_allocated): Set
no_imp_this_image if checking the allocation status of
a scalar.
* trans.h (gfc_se): Add no_impl_this_image flag.
gcc/testsuite/ChangeLog:
* gfortran.dg/caf-shared/scalar_alloc_1.f90: New test.
* gfortran.dg/caf-shared/scalar_alloc_2.f90: New test.
|
|
It seems we sometimes use DECL_ARTIFICIAL as choosing between
different code paths. In order not to make -fdebug-aux-vars
do different things, set DECL_ARTIFICIAL on the variables to
avoid these different code paths (and the corresponding
regressions).
gcc/fortran/ChangeLog:
* trans.c (create_var_debug_raw): Set DECL_ARTIFICIAL
on variables.
(cherry picked from commit 8d76c007afe4c70f51fd56b0e5b89522de5de61f)
|
|
gcc/fortran/ChangeLog:
* resolve.c (gfc_expr_to_initialize): Check for coarrays only
if the reference is right.
* trans-array.c (gfc_array_allocate): If SOURCE has a size,
use it.
|
|
It seems we sometimes use DECL_ARTIFICIAL as choosing between
different code paths. In order not to make -fdebug-aux-vars
do different things, set DECL_ARTIFICIAL on the variables to
avoid these different code paths (and the corresponding
regressions).
gcc/fortran/ChangeLog:
* trans.c (create_var_debug_raw): Set DECL_ARTIFICIAL
on variables.
|
|
gcc/fortran/ChangeLog:
* options.c (gfc_post_options): Always set flag_debug_aux_vars for
shared coarrays.
* resolve.c (gfc_expr_to_initialize): Set extra dimensions to
DIMEN_THIS_IMAGE.
* trans-array.c (cas_add_strides): Re-introduce.
(cas_add_this_image_offset): Rename add_lbound to
correct_full_offset, use cas_add_strides.
gcc/testsuite/ChangeLog:
* gfortran.dg/caf-shared/alloc_coarray_with_source_1.f90: New test.
* gfortran.dg/caf-shared/cobounds_torture_1.f90: New test.
* gfortran.dg/caf-shared/cobounds_torture_2.f90: New test.
* gfortran.dg/caf-shared/cobounds_torture_3.f90: New test.
|
|
|
|
2020-12-18 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/83118
PR fortran/96012
* resolve.c (resolve_ordinary_assign): Generate a vtable if
necessary for scalar non-polymorphic rhs's to unlimited lhs's.
* trans-array.c (get_class_info_from_ss): New function.
(gfc_trans_allocate_array_storage): Defer obtaining class
element type until all sources of class exprs are tried. Use
class API rather than TREE_OPERAND. Look for class expressions
in ss->info by calling get_class_info_from_ss. After, obtain
the element size for class descriptors. Where the element type
is unknown, cast the data as character(len=size) to overcome
unlimited polymorphic problems.
(gfc_conv_ss_descriptor): Do not fix class variable refs.
(build_class_array_ref, structure_alloc_comps): Replace code
replicating the new function gfc_resize_class_size_with_len.
(gfc_alloc_allocatable_for_assignment): Obtain element size
for lhs in cases of deferred characters and class enitities.
Move code for the element size of rhs to start of block. Clean
up extraction of class parameters throughout this function.
After the shape check test whether or not the lhs and rhs
element sizes are the same. Use earlier evaluation of
'cond_null'. Reallocation of lhs only to happen if size changes
or element size changes.
* trans-expr.c (gfc_resize_class_size_with_len): New function.
(gfc_get_class_from_expr): If a constant expression is
encountered, return NULL_TREE;
(trans_scalar_class_assign): New function.
(gfc_conv_procedure_call): Ensure the vtable is present for
passing a non-class actual to an unlimited formal.
(trans_class_vptr_len_assignment): For expressions of type
BT_CLASS, extract the class expression if necessary. Use a
statement block outside the loop body. Ensure that 'rhs' is
of the correct type. Obtain rhs vptr in all circumstances.
(gfc_trans_scalar_assign): Call trans_scalar_class_assign to
make maximum use of the vptr copy in place of assignment.
(trans_class_assignment): Actually do reallocation if needed.
(gfc_trans_assignment_1): Simplify some of the logic with
'realloc_flag'. Set 'vptr_copy' for all array assignments to
unlimited polymorphic lhs.
* trans.c (gfc_build_array_ref): Call gfc_resize_class_size_
with_len to correct span for unlimited polymorphic decls.
* trans.h : Add prototype for gfc_resize_class_size_with_len.
gcc/testsuite/
PR fortran/83118
PR fortran/96012
* gfortran.dg/dependency_60.f90: New test.
* gfortran.dg/class_allocate_25.f90: New test.
* gfortran.dg/class_assign_4.f90: New test.
* gfortran.dg/unlimited_polymorphic_32.f03: New test.
|
|
|
|
gcc/fortran/ChangeLog:
* trans-stmt.c (coarray_alloc_p): New function.
(gfc_trans_allocate): If there are shared coarrays present,
call sync all.
(gfc_trans_deallocate): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/caf-shared/allocate_1.f90: New test.
|
|
gcc/fortran/ChangeLog:
* trans.c (gfc_trans_memory_barrier_fence): New
function.
* trans.h (gfc_trans_memory_barrier_fence): Prototype it.
* trans-stmt.c (gfc_trans_sync): For shared coarrays,
use memory fence. Don't do anything else for SYNC MEMORY.
gcc/testsuite/ChangeLog:
* gfortran.dg/caf-shared/sync_all_1.f90: New test.
* gfortran.dg/caf-shared/sync_memory_1.f90: New test.
|
|
gcc/fortran/ChangeLog:
PR fortran/92587
* match.c (gfc_match_assignment): Move gfc_find_vtab call from here ...
* resolve.c (gfc_resolve_code): ... to here.
gcc/testsuite/ChangeLog:
PR fortran/92587
* gfortran.dg/finalize_37.f90: New test.
|
|
The dependency check for FORALL constructs already handled pointer
components to derived types, but missed allocatables. Fix that.
gcc/fortran/ChangeLog:
PR fortran/98307
* trans-stmt.c (check_forall_dependencies): Extend dependency
check to allocatable components of derived types.
gcc/testsuite/ChangeLog:
PR fortran/98307
* gfortran.dg/forall_19.f90: New test.
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/90207
* invoke.texi: Document -fdebug-aux-vars.
* lang.opt: Add -fdebug-aux-vars.
* trans.c (MAX_PREFIX_LEN): New macro.
(create_var_debug_raw): New function.
(gfc_create_var_np): Call create_var_debug_raw if
flag_debug_aux_vars is set.
(cherry picked from commit 662de36bf798c8c470b382015283fe3a439cdd8f)
|
|
gcc/fortran/ChangeLog:
* dump-parse-tree.c (show_array_ref): Also show coarrays.
(debug): Implement for array reference.
(cherry picked from commit 501f470267445e037614649639d17a1b32b4a9aa)
|
|
gcc/fortran/ChangeLog:
* dependency.c: Add options.h header.
(gfc_full_array_ref_p): Coarrays only are full if the have DIMEN_STAR.
* trans-array.c (cas_add_strides): Remove.
(cas_add_this_image_offset): Reorganize.
(cas_impl_this_image_ref): Fix return for reference.
(gfc_conv_ss_descriptor): Fix handling of offset.
(gfc_conv_array_ref): Likewise.
(gfc_trans_preloop_setup): Use effective dimension.
(gfc_conv_section_startstride): Shared coarrays should be handled
like deferred arrays.
(gfc_get_dataptr_offset): Adjust call to cas_add_this_image_offset.
(gfc_conv_expr_descriptor): Adjust dimensions.
(gfc_walk_array_ref): Likewise.
* trans-types.c (gfc_sym_type): Handle shared coarrays like
allocatable arrays.
(gfc_get_derived_type): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/caf-shared/lower_cobound_1.f90: New test.
* gfortran.dg/caf-shared/whole_array_1.f90: New test.
|
|
Reject DATA elements with the ALLOCATABLE attribute also when they are
components of a derived type.
gcc/fortran/ChangeLog:
PR fortran/98284
* resolve.c (check_data_variable): Reject DATA elements with the
ALLOCATABLE attribute.
gcc/testsuite/ChangeLog:
PR fortran/98284
* gfortran.dg/pr98284.f90: New test.
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/90207
* invoke.texi: Document -fdebug-aux-vars.
* lang.opt: Add -fdebug-aux-vars.
* trans.c (MAX_PREFIX_LEN): New macro.
(create_var_debug_raw): New function.
(gfc_create_var_np): Call create_var_debug_raw if
flag_debug_aux_vars is set.
|
|
|
|
gcc/fortran/ChangeLog:
* dump-parse-tree.c (show_array_ref): Also show coarrays.
(debug): Implement for array reference.
|
|
|
|
2020-12-12 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/98022
* data.c (gfc_assign_data_value): Handle inquiry references in
the data statement object list.
gcc/testsuite/
PR fortran/98022
* gfortran.dg/data_inquiry_ref.f90: New test.
|
|
|
|
gcc/fortran/ChangeLog:
* dump-parse-tree.c (show_omp_clauses, show_omp_node,
show_code_node): Handle OMP SCAN.
* gfortran.h (enum gfc_statement): Add ST_OMP_SCAN.
(enum): Add OMP_LIST_SCAN_IN and OMP_LIST_SCAN_EX.
(enum gfc_exec_op): Add EXEC_OMP_SCAN.
* match.h (gfc_match_omp_scan): New prototype.
* openmp.c (gfc_match_omp_scan): New.
(gfc_match_omp_taskgroup): Cleanup.
(resolve_omp_clauses, gfc_resolve_omp_do_blocks,
omp_code_to_statement, gfc_resolve_omp_directive): Handle 'omp scan'.
* parse.c (decode_omp_directive, next_statement,
gfc_ascii_statement): Likewise.
* resolve.c (gfc_resolve_code): Handle EXEC_OMP_SCAN.
* st.c (gfc_free_statement): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_do,
gfc_split_omp_clauses): Handle 'omp scan'.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/scan-1.f90: New test.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/reduction4.f90: Update; move FE some tests to ...
* gfortran.dg/gomp/reduction6.f90: ... this new test and ...
* gfortran.dg/gomp/reduction7.f90: ... this new test.
* gfortran.dg/gomp/reduction5.f90: Add dg-error.
* gfortran.dg/gomp/scan-1.f90: New test.
* gfortran.dg/gomp/scan-2.f90: New test.
* gfortran.dg/gomp/scan-3.f90: New test.
* gfortran.dg/gomp/scan-4.f90: New test.
* gfortran.dg/gomp/scan-5.f90: New test.
* gfortran.dg/gomp/scan-6.f90: New test.
* gfortran.dg/gomp/scan-7.f90: New test.
|
|
|
|
2020-12-05 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/98016
* resolve.c (resolve_symbol): Set formal_arg_flag before
resolving an array spec and restore value afterwards.
gcc/testsuite/
PR fortran/98016
* gfortran.dg/pr98016.f90: New test.
|
|
|
|
Add checks for NULL pointers before dereferencing them.
gcc/fortran/ChangeLog:
PR fortran/95342
* decl.c (gfc_match_function_decl): Avoid NULL pointer dereference.
(gfc_match_subroutine): Likewise.
gcc/testsuite/ChangeLog:
PR fortran/95342
* gfortran.dg/pr95342.f90: New test.
|
|
|
|
gcc/fortran/ChangeLog:
PR fortran/98011
* scanner.c (skip_free_comments, skip_fixed_comments): If only
-fopenacc but not -fopenmp is used, ignore OpenMP's conditional
compilation sentinels. Fix indentation, use 'else if' for readability.
gcc/testsuite/ChangeLog:
PR fortran/98011
* gfortran.dg/goacc/sentinel-free-form.f95:
* gfortran.dg/goacc-gomp/fixed-1.f: New test.
* gfortran.dg/goacc-gomp/free-1.f90: New test.
* gfortran.dg/goacc/fixed-5.f: New test.
|
|
Options: -fopenmp and -fopenacc imply concurrent calls to a
procedure; now also -fopenacc implies -frecursive, disabling
that larger local const-size array variables use static memory.
Run-time recursion check: Always reset the check variable at the
end of the procedure; this avoids a bogus error with -fopenmp
when called twice nonconcurrently/nonrecursively. (Issue requires
using -fno-automatic or -fmax-stack-var-size= to trigger.)
gcc/fortran/ChangeLog:
PR fortran/98010
PR fortran/98013
* options.c (gfc_post_options): Also imply recursive with
-fopenacc.
* trans-decl.c (gfc_generate_function_code): Simplify condition.
|