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/79072] ICE with class(*) pointer function result and character value


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

--- Comment #5 from neil.n.carlson at gmail dot com ---
Here's a more complete example that avoids the ICE.

It gives correct results with 6.3:
           5 fubar
           5 fubar

But incorrect results with 7.0:
           5 fubar
           0 


program main

  class(*), pointer :: x, y
  allocate(x, source='fubar')

  y => foobar(x)

  select type (y)
  type is (character(*))
    print *, len(y), y
  end select

contains

  function foobar(bar) result(foo)
    class(*), pointer :: foo, bar
    foo => bar
    select type (foo)
    type is (character(*))
      print *, len(foo), foo
    end select
  end function

end program

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