From: Thomas Koenig Date: Sun, 27 Dec 2020 15:31:33 +0000 (+0100) Subject: Fix errors introduced by last commit. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4c896fd159c3533fbaefa538fc6c6189b86bf21;p=thirdparty%2Fgcc.git Fix errors introduced by last commit. 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. --- diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 35afff5845e5..58aaa5f781d9 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3935,7 +3935,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr, /* Early return - only taken for ALLOCATED for shared coarrays. FIXME - this could probably be done more elegantly. */ - if (se->address_only) + if (flag_coarray == GFC_FCOARRAY_SHARED && ar->codimen && se->address_only) { se->expr = build_array_ref (se->expr, build_int_cst (TREE_TYPE (offset), 0), decl, se->class_vptr); diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f3526db7ea63..ab2725ca6f18 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -3736,8 +3736,11 @@ gfc_build_intrinsic_function_decls (void) void gfc_build_builtin_function_decls (void) { + tree gfc_int4_type_node = gfc_get_int_type (4); + tree gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node); tree gfc_int8_type_node = gfc_get_int_type (8); tree pint_type = build_pointer_type (integer_type_node); + tree pchar1_type_node = gfc_get_pchar_type (1); gfor_fndecl_stop_numeric = gfc_build_library_function_decl ( get_identifier (PREFIX("stop_numeric")), @@ -4123,8 +4126,8 @@ gfc_build_builtin_function_decls (void) size_type_node, /* elem_size. */ integer_type_node, /* corank. */ integer_type_node, /* alloc_type. */ - pvoid_type_node, /* stat. */ - pvoid_type_node, /* errmsg. */ + gfc_pint4_type_node, /* stat. */ + pchar1_type_node, /* errmsg. */ gfc_charlen_type_node, /* errmsg_len. */ NULL_TREE); gfor_fndecl_cas_coarray_free = gfc_build_library_function_decl_with_spec ( @@ -4697,8 +4700,8 @@ gfc_trans_shared_coarray (stmtblock_t * init, stmtblock_t *cleanup, gfc_symbol * NULL_TREE, true, NULL, &element_size); elem_size = size_in_bytes (gfc_get_element_type (TREE_TYPE(decl))); gfc_allocate_shared_coarray (init, decl, elem_size, sym->as->rank, - sym->as->corank, alloc_type, null_pointer_node, - null_pointer_node, + sym->as->corank, alloc_type, + NULL_TREE, NULL_TREE, build_int_cst (gfc_charlen_type_node, 0), false); gfc_conv_descriptor_offset_set (init, decl, offset); diff --git a/gcc/testsuite/gfortran.dg/caf-shared/cas.exp b/gcc/testsuite/gfortran.dg/caf-shared/cas.exp index 86e6b97090b5..8f73bf24b88b 100644 --- a/gcc/testsuite/gfortran.dg/caf-shared/cas.exp +++ b/gcc/testsuite/gfortran.dg/caf-shared/cas.exp @@ -47,7 +47,7 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] if ![runtest_file_p $runtests $test] then { continue } - set option_list [list { -O2 } ] + set option_list [list { -g -O2 } ] set nshort [file tail [file dirname $test]]/[file tail $test] list-module-names $test diff --git a/libgfortran/caf_shared/util.h b/libgfortran/caf_shared/util.h index fa9e158b38f9..6ae37780fb48 100644 --- a/libgfortran/caf_shared/util.h +++ b/libgfortran/caf_shared/util.h @@ -28,6 +28,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include #include #include +#include +#include + +#define CAS_DEBUG_PR(str, ...) dprintf(2, "Image %d (pid %ld):\t" str "\n", this_image.image_num, (unsigned long) getpid(), ##__VA_ARGS__) #define PTR_BITS (CHAR_BIT*sizeof(void *))