- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I always used to copy contiguous elements betweencommon blocks or within a common block usingthe followingfunction:
Code:
SUBROUTINE A203(L,A,B) C*********************************************************************** C A203 - COPIES L ARRAY ELEMENTS, STARTING WITH ELEMENT 1 OF * C ARRAY A TO ELEMENT 1 OF ARRAY B * C*********************************************************************** USE PRECISION IMPLICIT NONE INTEGER(ISP), INTENT(IN) :: L REAL(FP), DIMENSION(1), INTENT(IN) :: A REAL(FP), DIMENSION(1), INTENT(OUT) :: B INTEGER(ISP) :: I DO I=1,L B(I)=A(I) ENDDO RETURN END
It still functions, but since IVF version 9.0 offers the possibility I switched on /gen-interfaces /warn:interfaces and now I get the following warning and the build stops:
Error: 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.
The entries of the common block(s) are indeed scalar.
Ithere a better way of copying contiguous elements between or within common blocks, so I can keep the aforementioned compiler options on and further investigate my application?
Thanks,
Walter
Message Edited by wkramer on 07-04-2005 11:14 AM
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My advice would be:
1. Replace DIMENSION(1) with DIMENSION(*)
2. Add the line:
!DEC$ ATTRIBUTES NO_ARG_CHECK :: A, B
3. Write an explicit interface for this routine (as above) and make it visible to the caller.
I don't think the /gen_interfaces copies the NO_ARG_CHECK directive, though perhaps it should.
Are the array contents always REAL? If they can be other types, you may be in for some surprises....
1. Replace DIMENSION(1) with DIMENSION(*)
2. Add the line:
!DEC$ ATTRIBUTES NO_ARG_CHECK :: A, B
3. Write an explicit interface for this routine (as above) and make it visible to the caller.
I don't think the /gen_interfaces copies the NO_ARG_CHECK directive, though perhaps it should.
Are the array contents always REAL? If they can be other types, you may be in for some surprises....
Message Edited by sblionel on 07-04-2005 04:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Steve,
Thanks, your suggestion works, but I found out that the applicationcontains hundreds of calls to similar type of routines and what is even worse: reals, Integers and character(4) strings are mixed in common blocks.Common blocks are used as a contiguous memory block and arrays of reals, integers, character strings and even user defined types are filled from there using the type of routines as I described.
So I can just hope that I won't be in for the surprises you mentioned.
Regards,
Walter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In that case, you definitely want to declare the arrays as INTEGER and not REAL. Performance will go up and you'll not get some values changed when they copy. (Anything that looks like a "Signaling NaN" will get changed to a "Quiet NaN".)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page