Bug 23654 - internal compiler error: in gfc_conv_function_call
Summary: internal compiler error: in gfc_conv_function_call
Status: RESOLVED DUPLICATE of bug 15326
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-31 14:21 UTC by Jos de Kloe
Modified: 2005-08-31 15:15 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jos de Kloe 2005-08-31 14:21:06 UTC
The following i.m.o. correct code lets gfortran crash:

module problem
  implicit none
contains
  !---
  subroutine compare_words
    character(len=1), dimension(:), pointer :: word1
    allocate(word1(5))
    word1(1:5) = (/ '1','2','3','4','5' /)
    call print_word(chararray2string(word1))
    deallocate(word1)
  end subroutine compare_words
  !---
  subroutine print_word(word1)
    character(len=*), intent(in) :: word1 ! input
    print *,"word1 = ",word1
  end subroutine print_word
  !---  
  function chararray2string(chararray) result(text)
    !  #[
    character(len=1), dimension(:) :: chararray      ! input
    character(len=size(chararray)) :: text           ! output
    text = transfer(chararray,text)
  end function chararray2string
  !---
end module problem

program testproblem
  USE problem, only: compare_words
  call compare_words
end program Testproblem


The compiler responds as follows:

>gfortran -o problem problem.F90
problem.F90: In function ‘compare_words’:
problem.F90:8: internal compiler error: in gfc_conv_function_call, at
fortran/trans-expr.c:1107
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
>
Comment 1 Andrew Pinski 2005-08-31 15:15:16 UTC
Reduced testcase:
module problem
contains
  subroutine compare_words
    character(len=1), dimension(:), pointer :: word1
    call print_word(chararray2string(word1))
  end subroutine compare_words
  subroutine print_word(word1)
    character(len=*), intent(in) :: word1 ! input
  end subroutine print_word
  function chararray2string(chararray) result(text)
    character(len=1), dimension(:) :: chararray      ! input
    character(len=size(chararray)) :: text           ! output
  end function chararray2string
end module problem

Which means this is a dup of bug 15326.

*** This bug has been marked as a duplicate of 15326 ***