[Bug fortran/79072] ICE with class(*) pointer function result and character value

neil.n.carlson at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Nov 19 00:27:00 GMT 2017


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

--- Comment #11 from neil.n.carlson at gmail dot com ---
Paul, I'm organizing all my bug report examples, and ran across these two test
cases from September that I can't find I ever reported.  They are VERY similar
to the original example I posted, except the ICE occurs in a different file, so
I thought I'd add them here.  I can submit a separate PR if you think it more
appropriate.

The first compiles on 6.4.1, 7.2.1, and 8.0.0 (20171028). But produces an
incorrect result:

b="" (expect "foo")

character(3), target :: a = 'foo'
class(*), pointer :: b
b => ptr()
select type (b)
type is (character(*))
  print '(3a)', 'b="', b, '" (expect "foo")'
end select
contains
  function ptr()
    class(*), pointer :: ptr
    ptr => a
  end function
end


More information about the Gcc-bugs mailing list