------- Comment #1 from kargl at gcc dot gnu dot org  2007-08-23 00:09 -------
It's much worse than you've indicated. :(

gfortran compiles 

  subroutine y
  data emname/'bar'/
  character(len=3) :: emname
  end subroutine y

which violates "A variable that appears in a DATA statement and has not
been typed previously may appear in a subsequent type declaration only if
that declaration confirms the implicit typing."  See 5.2.10.

The ICE in your Var. 3 occurs in this simplified code

  subroutine z
  integer, parameter :: nmin=2
  data emname/'bar','baz'/
  character(len=3) :: emname(nmin)
  end subroutine z

so the fact that we've changed to an array of strings isn't
handled correctly.  I think an error should occur here because
"An array name, array section, or array element that appears in a
DATA statement shall have had its array properties established by
a previous specification statement." See 5.2.10. That is, the order
of the statements is wrong.

Your variations 1 and 2 should be legal via 5.5.2.4(3): "A data object
in a named common block may be initially defined by means of a DATA
statement or type declaration statement in a block data program unit 
(11.4), but objects in blank common shall not be initially defined."

It seems gfortran is ignoring the "block data program unit" part of
the above.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33152

Reply via email to