This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/78867] New: GFortran function returning string ICE with -flto


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

            Bug ID: 78867
           Summary: GFortran function returning string ICE with -flto
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jb at gcc dot gnu.org
  Target Milestone: ---

The following testcase fails when compiled with -flto. Enabling optimization
makes it work, e.g. "-O1 -flto".

! { dg-do compile }
! { dg-options "-flto" }
program test
  if (len(bar(2_8)) /= 2_8) call abort
contains

  function bar(i)
    integer(8), intent(in) :: i
    character(len=i) :: bar

    bar = ""
  end function bar

end program test


Backtrace:

lto1: internal compiler error: Segmentation fault
0xb7daa6 crash_signal
        ../../trunk-git/gcc/toplev.c:333
0x9ec02b lto_input_tree_ref(lto_input_block*, data_in*, function*, LTO_tags)
        ../../trunk-git/gcc/lto-streamer-in.c:332
0x9ec21d lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
        ../../trunk-git/gcc/lto-streamer-in.c:1446
0x9ec65e lto_input_tree(lto_input_block*, data_in*)
        ../../trunk-git/gcc/lto-streamer-in.c:1492
0xe590db lto_input_ts_exp_tree_pointers
        ../../trunk-git/gcc/tree-streamer-in.c:893
0xe5c1f6 streamer_read_tree_body(lto_input_block*, data_in*, tree_node*)
        ../../trunk-git/gcc/tree-streamer-in.c:1079
0x9eb499 lto_read_tree_1
        ../../trunk-git/gcc/lto-streamer-in.c:1333
0x9eb53a lto_read_tree
        ../../trunk-git/gcc/lto-streamer-in.c:1363
0x9ec3c2 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
        ../../trunk-git/gcc/lto-streamer-in.c:1475
0x9ec478 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned
int*)
        ../../trunk-git/gcc/lto-streamer-in.c:1387
0x9ec64c lto_input_tree(lto_input_block*, data_in*)
        ../../trunk-git/gcc/lto-streamer-in.c:1490
0x9ee6ed input_function
        ../../trunk-git/gcc/lto-streamer-in.c:1045
0x9ef07f lto_read_body_or_constructor
        ../../trunk-git/gcc/lto-streamer-in.c:1259
0x9ef408 lto_input_function_body(lto_file_decl_data*, cgraph_node*, char
const*)
        ../../trunk-git/gcc/lto-streamer-in.c:1307
0x6b282b cgraph_node::get_untransformed_body()
        ../../trunk-git/gcc/cgraph.c:3581
0x6c26d6 cgraph_node::expand()
        ../../trunk-git/gcc/cgraphunit.c:1971
0x6c3765 output_in_order
        ../../trunk-git/gcc/cgraphunit.c:2244
0x6c4224 symbol_table::compile()
        ../../trunk-git/gcc/cgraphunit.c:2488
0x6028b5 lto_main()
        ../../trunk-git/gcc/lto/lto.c:3330
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: fatal error: gfortran returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status



The problem seems to be related to the typecasting needed when converting the
integer(kind=8) variables to character length variables (which on trunk are
integer(kind=4). If one changes the testcase to use default kind integers, it
works.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]