https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78757
Bug ID: 78757 Summary: ICE with function returning a pointer to a character 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 causes an ICE when compiling with -O1 on x86_64-pc-linux-gnu on todays (2016-12-09) trunk: ! Reduced and modified from char_result_8.f90 ! { dg-do run } program main implicit none character (len = 30), target :: string character(len=30), pointer :: s s => f4(70_8) contains function f4 (i) integer(8) :: i character (len = i), pointer :: f4 f4 => string end function f4 end program main A slightly different way of causing (most likely) the same bug to appear (compile with "-O1 -fdefault-integer-8"): ! Reduced from char_result_8.f90 ! { dg-options "-fdefault-integer-8" } ! { dg-do run } program main implicit none character (len = 30), target :: string character(len=30), pointer :: s s => f4(70) contains function f4 (i) integer :: i character (len = i), pointer :: f4 f4 => string end function f4 end program main