Discussion:
[G95-develop] poor reporting of "Assumed size array at (1) must be a dummy argument" errors.
Gareth Pearce
2002-09-29 22:23:04 UTC
Permalink
Okay, so I have been attempting to test g95 on the CPMD source code - a very
powerful program for simulating small systems of atoms with full quantum
mechanical accuracy, and two issues show up immediately - one the lack of
POINTER type and two a very large number of "assumed size arrray at(?) must
be a dummy argument" errors.

Oddly i reduced a testcase ... and it fails to compile on laheyf95 (with the
dummy argument error)- even though cpmd compiles on laheyf95 just fine...
I think its something to do with POINTER ... but havent had a chance to look
at it properly.


However the reduced testcase is interesting in itself.

$ cat test.f
subroutine blah
INTEGER IATPT
DIMENSION IATPT(2,*)
end

gives
INTEGER IATPT
1
Error: Assumed size array at (1) must be a dummy argument


This kind of error confused me greatly for a while. Surely the error should
point to the use of DIMENSION - instead of the original declaration. Both
lahey and intel fortran point to line 3 as error.

Gareth



_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
Tobias Schlüter
2002-09-29 22:57:02 UTC
Permalink
Your testcase doesn't look like valid code. How will the size of
IATPT be determined?

But a slight modification will make it work with g95: write something
like this:

SUBROUTINE blah
INTEGER, POINTER :: blubb(:)
END SUBROUTINE

The difference is that blubb now is a POINTER. g95's error message
should also include this, saying something along the lines of: "array
not having fully specified dimensions must have the POINTER or
ALLOCATABLE attribute or alternatively be a dummy argument" (or
should a compiler not teach the language? :-) Check the F95 standard
for the exact requirements). In your example it's neither.

Can you try to distill a testcase which shows your problem, including
the pointers? I think your real problem might actually be something
with the POINTER support in g95, but it's difficult to see if it's
not in your testcase (alternatively: is the CPMD source code
available? This might be an interesting addition to the compiler's
testsuite.)
Post by Gareth Pearce
two issues show up immediately - one the lack of
POINTER type and two a very large number of "assumed size arrray
^^^^^
POINTER is an attribute to a type in standard Fortran 95 and (mostly)
supported by g95. Are you referring to some language extension here?

Regards,
- Tobias Schl=FCter
Post by Gareth Pearce
Okay, so I have been attempting to test g95 on the CPMD source code - a =
very
Post by Gareth Pearce
powerful program for simulating small systems of atoms with full quantum
mechanical accuracy, and two issues show up immediately - one the lack o=
f
Post by Gareth Pearce
POINTER type and two a very large number of "assumed size arrray at(?) m=
ust
Post by Gareth Pearce
be a dummy argument" errors.
Oddly i reduced a testcase ... and it fails to compile on laheyf95 (with=
the
Post by Gareth Pearce
dummy argument error)- even though cpmd compiles on laheyf95 just fine..=
.
Post by Gareth Pearce
I think its something to do with POINTER ... but havent had a chance to =
look
Post by Gareth Pearce
at it properly.
However the reduced testcase is interesting in itself.
$ cat test.f
subroutine blah
INTEGER IATPT
DIMENSION IATPT(2,*)
end
gives
INTEGER IATPT
1
Error: Assumed size array at (1) must be a dummy argument
This kind of error confused me greatly for a while. Surely the error sh=
ould
Post by Gareth Pearce
point to the use of DIMENSION - instead of the original declaration. Bo=
th
Post by Gareth Pearce
lahey and intel fortran point to line 3 as error.
Gareth
_________________________________________________________________
Join the world=92s largest e-mail service with MSN Hotmail.
http://www.hotmail.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
G95-develop mailing list
https://lists.sourceforge.net/lists/listinfo/g95-develop
Andrew Vaught
2002-10-01 04:07:01 UTC
Permalink
Post by Gareth Pearce
$ cat test.f
subroutine blah
INTEGER IATPT
DIMENSION IATPT(2,*)
end
gives
INTEGER IATPT
1
Error: Assumed size array at (1) must be a dummy argument
This kind of error confused me greatly for a while. Surely the error should
point to the use of DIMENSION - instead of the original declaration. Both
lahey and intel fortran point to line 3 as error.
As Steven correctly points out, the check is (and must) happen in the
type resolution phase. You could have something like:

subroutine blah
INTEGER IATPT
DIMENSION IATPT(2,*)

entry blechh(IATPT)

end

and all would be well. Storing where IATPT aquires the DIMENSION
attribute would be awkward at best. What happens on Intel/Lahey if you
reverse lines 2 & 3?

Andy

----------------- XOLD(K,IC,I)=
Andy Vaught .... DO ITERS=1, 10 XOLD(K,IC,I)
***@xena.eas.asu.edu | | /CALLMSOLVE(A,B,X,I,ITERS,TOL)+(RANNYU(0)
Arizona State University ======|WRITE(6,'(I5,2X,F12.6)')ITERS,TOL -HALF)
Tempe, Arizona USA OOOOOO \ENDDORETURN PARAMETER(ZERO=1.D0)*TENTH*DELTA
Loading...