[Patch, Fortran] [RFC] PR fortran/36746 / missing part from PR 32095?
Daniel Kraft
d@domob.eu
Thu Sep 4 18:57:00 GMT 2008
Hi,
this is a proposed patch for PR fortran/36746. There, code like
IMPLICIT TYPE(t) (x)
DIMENSION x(:)
PRINT *, x(1)%comp
is rejected because the parser does not yet know x is of a derived-type
when the component reference is encountered (because the type is
IMPLICIT). At least it's something similar to this description...
I'm thinking if this is a missed part of PR 32095 where I introduced
code to check for symbols being used before they get a type. Does the
DIMENSION statement count as such a "use"? This way, my patch attaches
the IMPLICIT type on encountering x in the DIMENSION statement and the
code compiles just fine. On the other hand, however, code that gets now
rejected is:
IMPLICIT TYPE(t) (x)
DIMENSION x(:)
INTEGER :: x ! 'x' already has a type (TYPE(t))!
Is code like that legal? I don't know what the standard says about it,
but I would guess intuitively that it isn't and it is indeed a missed
part of PR 32095. What do you think, is my patch legal? And if it is,
are there other cases apart from DIMENSION where I should enable this
typing in attr_decl1 (POINTER, ALLOCATABLE or maybe INTENT come to mind)?
gfortran.fortran-torture/execute/equiv_[2/4].f90 use code like the
above, though, where there's a DIMENSION before the type gets declared.
With my patch, I see some regressions apart from that one (in three
files) at the moment, but those seem all to be invalid code that now
gets "another" error, and with fine-tuning the patch and changing
expected error messages that should go fine.
Yours,
Daniel
--
Done: Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
To go: Hea-Kni-Mon-Pri-Ran-Rog-Tou
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.changelog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080904/b99e631d/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080904/b99e631d/attachment-0001.ksh>
More information about the Fortran
mailing list