[Bug fortran/103301] New: co_broadcast: broadcast of an object of a derived type with custom assignment operator defined

xavier.daura at uab dot cat gcc-bugzilla@gcc.gnu.org
Wed Nov 17 11:11:19 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103301

            Bug ID: 103301
           Summary: co_broadcast: broadcast of an object of a derived type
                    with custom assignment operator defined
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xavier.daura at uab dot cat
  Target Milestone: ---

Before making a full report, I'd like to specify first the case, since I am not
sure whether gfortran should be able to handle this.

According to the Fortran 2018 ISO, the first argument to co_broadcast "shall
have the same shape, dynamic type, and type parameter values, in corresponding
references. It shall not be a coindexed object. [...]  If no error condition
occurs, A becomes defined, as if by intrinsic assignment, on all images [...]"

Similarly, according to the gfortran 11.2.0 manual it "shall have the same dy-
namic type and type parameters on all images of the current team. If it is an
array, it shall have the same shape on all images."

My understanding (but I may well be wrong) is that neither description excludes
objects of a derived type with non-coarray components. I also understand that
for this to work on an object, the corresponding derived type needs to have a
custom assignment operator defined.

The program in question fails to compile producing an internal compiler error
at: call co_broadcast(sys_cnf, 1), where sys_cnf is such an object.

If this is not supposed to work, there is nothing else to say, but I guess the
compiler should say so instead of giving an internal compiler error and asking
to submit a bug report. Otherwise, if it is supposed to work, I'll be happy to
complement the information given here with the preprocessed code so that the
problem can be sorted out.

System:
CentOS 8, kernel 5.15.2-1.el8.elrepo.x86_64

Compiler details:
caf : opencoarrays 2.9.2
gfortran : gcc 11.2.0

Configuration at installation:
gcc : path_to_gcc-11.2.0/configure --enable-languages=fortran
--disable-multilib
opencoarrays : FC=path_to_gfortran-11.2.0 cmake path_to_OpenCoarrays-2.9.2

Compilation instruction and error:
caf -c  -std=f2018 -g -O0 -fcheck=all -fbacktrace -Jmod src/prg_nrgmin.f90 -o
obj/prg_nrgmin.o                                                   
src/prg_nrgmin.f90:78:32:                                                       

   78 |    call co_broadcast(sys_cnf, 1)                                        
      |                                1                                        
internal compiler error: in gfc_get_descriptor_field, at
fortran/trans-array.c:140                                                       
0x618734 gfc_get_descriptor_field
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:140
0x760585 gfc_get_descriptor_dimension(tree_node*)
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:294
0x760585 gfc_conv_descriptor_dimension
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:306
0x760585 gfc_conv_descriptor_subfield
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:326
0x76a60e gfc_conv_descriptor_ubound
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:390
0x76a60e gfc_conv_descriptor_ubound_get(tree_node*, tree_node*)
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:398
0x76a60e gfc_full_array_size(stmtblock_t*, tree_node*, int)
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:8345
0x7708c2 structure_alloc_comps
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:8853
0x775947 gfc_bcast_alloc_comp(gfc_symbol*, gfc_expr*, int, tree_node*,
tree_node*, tree_node*, tree_node*)                                      
        ../../gcc-11.2.0/gcc/fortran/trans-array.c:9836
0x7b3a11 conv_co_collective
        ../../gcc-11.2.0/gcc/fortran/trans-intrinsic.c:11344
0x7b3a11 gfc_conv_intrinsic_subroutine(gfc_code*)
        ../../gcc-11.2.0/gcc/fortran/trans-intrinsic.c:12471
0x75bef2 trans_code
        ../../gcc-11.2.0/gcc/fortran/trans.c:1991
0x785b69 gfc_generate_function_code(gfc_namespace*)
        ../../gcc-11.2.0/gcc/fortran/trans-decl.c:6893
0x7015ae translate_all_program_units
        ../../gcc-11.2.0/gcc/fortran/parse.c:6354
0x7015ae gfc_parse_file()
        ../../gcc-11.2.0/gcc/fortran/parse.c:6623
0x7590ef gfc_be_parse_file
        ../../gcc-11.2.0/gcc/fortran/f95-lang.c:212
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Error: comand:
   `/usr/local/bin/gfortran -I/usr/local/include/OpenCoarrays-2.9.2_GNU-11.2.0
-fcoarray=lib -pthread -c -std=f2018 -g -O0 -fcheck=all -fbacktrace -Jmod
src/prg_nrgmin.f90 -o obj/prg_nrgmin.o`
failed to compile.
make: *** [Makefile:85: obj/prg_nrgmin.o] Error 1


More information about the Gcc-bugs mailing list