This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33686] FORALL loop gives wrong result
- From: "enok at lysator dot liu dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Oct 2007 09:42:08 -0000
- Subject: [Bug fortran/33686] FORALL loop gives wrong result
- References: <bug-33686-7816@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from enok at lysator dot liu dot se 2007-10-08 09:42 -------
Do you mean the fact that assignment expressions within a forall loop may be
executed in any order? But within a single assignment it seems that the right
hand side and any expressions within the left hand side must be evaluated
before any assignments take place. I quote Dick Hendrickson in
comp.lang.fortran in the thread "Most elegant syntax for inverting a
permutation?":
The form of an assignment statement is
variable = expr
In 7.4.4.2.3, execution of FORALL, it says
"Execution of a forall-assignment-stmt that is an assignment-stmt causes
the evaluation of expr and all expressions within variable for all
active combinations of index-name values. These evaluations may be
done in any order. After all these evaluations have been performed, each
expr value is assigned to the corresponding variable. The assignments
may occur in any order."
In 7.4.1.3 interpretation of intrinsic assignment, it says
"Execution of an intrinsic assignment causes, in effect, the evaluation
of the expression expr and all expressions within variable (7.1.8), the
possible conversion of expr to the type and type parameters
of variable (Table 7.9), and the definition of variable with the
resulting value. The execution of the assignment shall have the same
effect as if the evaluation of all operations in expr and variable
occurred before any portion of variable is defined by the assignment."
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33686