This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/21409] Attached fortran 95 code generates error


------- Additional Comments From eedelman at acclab dot helsinki dot fi  2005-05-06 16:59 -------
(In reply to comment #2)
> Reduced testcase (I tried not to reduce it too much):
>       subroutine  difq3 (jmax, ngmax, ams)
>       implicit none
>       integer*4 :: jmax, ngmax
>       real*8, dimension(32) ::  ams
>       real*8, dimension(32) ::  edd
>       integer*4 :: j
>       forall (j=2:jmax)
>          ams(1:ngmax)= edd(j-1)
>       end forall
>       end
> 
> 
> But note I get a warning with ICC:
> fortcom: Warning: t.f, line 8: All active combinations of index-names are not
used within the variable 
> being defined (i.e., leftside) of this assignment-stmt.   [AMS]
>          ams(1:ngmax)= edd(j-1)
> .........^
> 
> So I don't know if this code is valid or not.

I don't think it is valid; from the F2003 (draft) standard, section 7.4.4.4:

"A many-to-one assignment is more than one assignment to the same object, or
association of more than one target with the same pointer, whether the object is
referenced directly or indirectly through a pointer. A many-to-one assignment
shall not occur within a single statement in a FORALL construct or
statement."

In any case, that code does not make much sense to me: different values are
assigned to the same variable in undefined order (or even simultaneously).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21409


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]