[Patch, Fortran] PR 47569 - fix ICE (regression) and fix diagnostic

Tobias Burnus burnus@net-b.de
Fri Feb 11 23:27:00 GMT 2011


PR 47569 is about a 4.3/4.4/4.5/4.6 regression where 
"component%substring(1:2)" gave an ICE. Looking closer at the issue, I 
saw that the checks were a bit incomplete and inconsistent. I hope that 
with the patch the diagnostic is now correct.

 From the standards:

F97: "If the actual argument is scalar, the corresponding dummy argument 
shall be scalar unless the actual argument is an element of an array 
that is not an assumed-shape or pointer array, or a substring of such an 
element."

F2003: "If the actual argument is scalar, the corresponding dummy 
argument shall be scalar unless the actual argument is of type default 
character, of type character with the C character kind (15.1), or is an 
element or substring of an element of an array that is not an 
assumed-shape or pointer array."

F2008 quote ("12.5.2.4 Ordinary dummy variables"):
"If the actual argument is a noncoindexed scalar, the corresponding dummy
argument shall be scalar unless the actual argument is default character, of
type character with the C character kind (15.2.2), or is an element or
substring of an element of an array that is not an assumed-shape, 
pointer, or
polymorphic array."

(The coindex/polymorphism is checked earlier in that function.)

Build and regtested on x86-64-linux.
OK for the trunk? Should this be backported? If yes, to which versions?*

Tobias

* The issue was reported for a real-world code using GCC 4.4.4. While 
passing a scalar actual to an array dummy is common in pre-Fortran-90, I 
think doing so in F90+ code happens more rarely - but as the PR shows, 
it happens.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arg-check-ice-v4.diff
Type: text/x-patch
Size: 18984 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110211/84e30663/attachment.bin>


More information about the Fortran mailing list