[Patch, Fortran] Add parsing support for assumed-rank array

Tobias Burnus burnus@net-b.de
Sun Jul 15 19:14:00 GMT 2012


Hello,

attached is an updated version of the patch. Changes:

* Passing scalars to assumed-rank arrays works now.
* The scalarizer is now untouched, i.e. lbound/ubound don't work – not 
even with dim=.
* Fixes according to review comments – and some other fixes
* Unrelated bug fixes, found when writing the test cases and thus included:
- Polymorphic variables: assumed-shape variables had an as->type of 
AS_DEFERRED
- Polymorphic scalars: Allocatable and pointer couldn't be mixed (type 
override issue)
- Polymorphic dummies: Passing null() to optional args – constraints 
check didn't trigger properly

Still to be done:
* lbound/ubound/shape
* Class assumed-rank to (contiguous) type [i.e. packing]
* Assumed-size to assumed-rank, and checking some other combinations for 
issues.
* Using assumed-rank arguments with elemental functions – for the 
internal FINAL implementation
* CLASS(*) support
* C-binding changes: C_LOC etc.; implementation of IS_CONTIGUOUS
* New array descriptor ;-)


Mikael Morin wrote:
> What about naming the flag in_actual_arg and moving the 
> inquiry_argument condition to the error condition? 

That doesn't work as it is not only valid as inquiry argument but also 
for other actual arguments – those which have an assumed-type or 
assumed-rank dummy argument.


> Well, my problem with it is that it doesn't tell what is invalid.
> What do you think about "Assumed rank variable %s at %L can only be used
> as an actual argument." ?

I changed the error message along that way.

> I think that currently your foo(x+1) case doesn't trigger an error.
> It's not in your testcases at least.

Fixed that – and added a test case.

> ... according to this, a bare variable name is also a designator, and it
> is valid.  So issuing errors because the variable is/has a designator
> seems confusing at best. I'm almost satisfied with this (maybe
> s/with/in/ or s/be used with/???/) :
> "Assumed-rank variable %s at %L cannot be used with a subobject reference."

I modified the error message to be similar to your proposal.

The patch was build and regtested on x86-64-linux.
OK for the trunk?

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: assumed-rank-2012-07-15.diff
Type: text/x-patch
Size: 72864 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120715/39c20961/attachment.bin>


More information about the Gcc-patches mailing list