[Patch, Fortran] PR fortran/35770: Wrong implicit character typing

Daniel Kraft d@domob.eu
Fri Sep 12 18:47:00 GMT 2008


Hi,

when gfc_match_varspec encounters a symbol of yet unknown type, it tries 
to type it as IMPLICIT CHARACTER and match a sub-string reference; if 
this matching fails, the type spec is reset.  This however was 
incomplete leading to the problem in PR 35770.  The attached patch fixes 
this.

The same implicit typing is done for derived types, but only if the 
following character is a '%' so I think this is safe as in that case for 
the code to be valid the expression must indeed be of a derived type 
(correct me if I'm wrong).

With this fix, substring references should be also safe again, as they 
can be distinguished from function calls, AFAIK (now I know the reason 
for why 1:1 is a valid substring ref but 1 alone is not).

Is there implicit typing of arrays?  Like

IMPLICIT INTEGER(5) (a)

So that abc will be an array of 5 integers?  I don't think so.  But if 
this was allowed, there could be another problem with ambiguosity.

Well, enough about those references in general :)  It's just I've looked 
though this code to check for problems like that in the PR and didn't 
come up with any...

Patch is regression testing on GNU/Linux-x86-32.  Ok for trunk (and 
4.3?) if no regressions?

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/20080912/cbc8d922/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080912/cbc8d922/attachment-0001.ksh>


More information about the Fortran mailing list