[Bug fortran/35339] Improve translation of implied do loop in transfer

koenigni at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 25 19:56:00 GMT 2017


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

Nicolas Koenig <koenigni at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |koenigni at gcc dot gnu.org

--- Comment #6 from Nicolas Koenig <koenigni at gcc dot gnu.org> ---
Created attachment 41419
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41419&action=edit
Early patch for simplifying impl do loops

Attached is a patch that simplifies implied do loops in the way suggested by
Thomas. There are, however, still a few problems with this patch that I have a
hard time understanding. For example:

gcc@dcm-linux:~/pr/35339> cat z1.f90
program main
    implicit none
    integer:: i
    integer, dimension(2,2):: a = reshape([1, 2, 3, 4], shape(a))
    write (*,*) (a(i, 1), i=1,2)
end program
gcc@dcm-linux:~/pr/35339> gfortran -O z1.f90
z1.f90:5:0:

     write (*,*) (a(i, 1), i=1,4)

internal compiler error: Segmentation fault
0xbe58af crash_signal
        ../../trunk/gcc/toplev.c:337
0x6bea8d gfc_conv_scalarized_array_ref
        ../../trunk/gcc/fortran/trans-array.c:3228
0x6bfb1c gfc_conv_array_ref(gfc_se*, gfc_array_ref*, gfc_expr*, locus*)
        ../../trunk/gcc/fortran/trans-array.c:3382
0x6f95cd gfc_conv_variable
        ../../trunk/gcc/fortran/trans-expr.c:2680
0x6f529a gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../trunk/gcc/fortran/trans-expr.c:7815
0x6fd41e gfc_conv_expr_reference(gfc_se*, gfc_expr*)
        ../../trunk/gcc/fortran/trans-expr.c:7915
0x724862 gfc_trans_transfer(gfc_code*)
        ../../trunk/gcc/fortran/trans-io.c:2539
0x6b3d37 trans_code
        ../../trunk/gcc/fortran/trans.c:2017
0x7214f2 build_dt
        ../../trunk/gcc/fortran/trans-io.c:2017
0x6b3d57 trans_code
        ../../trunk/gcc/fortran/trans.c:1989
0x6e5498 gfc_generate_function_code(gfc_namespace*)
        ../../trunk/gcc/fortran/trans-decl.c:6332
0x66c576 translate_all_program_units
        ../../trunk/gcc/fortran/parse.c:6074
0x66c576 gfc_parse_file()
        ../../trunk/gcc/fortran/parse.c:6274
0x6afe9f gfc_be_parse_file
        ../../trunk/gcc/fortran/f95-lang.c:204
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.


probably because the new 'transfer'-statement isn't properly inserted in the
code tree.


More information about the Gcc-bugs mailing list