User account creation filtered due to spam.

Bug 35769 - inappropriate FORALL error
Summary: inappropriate FORALL error
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Paul Thomas
Keywords: rejects-valid
Depends on:
Blocks: 32834
  Show dependency treegraph
Reported: 2008-03-30 20:45 UTC by Dick Hendrickson
Modified: 2008-11-08 06:50 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail: 4.4.0
Last reconfirmed: 2008-03-30 21:27:35


Note You need to log in before you can comment on or make changes to this bug.
Description Dick Hendrickson 2008-03-30 20:45:00 UTC
The following (silly) program gives an incorrect error message.
There is only one assignment to each diagonal element of
the array.  I don't feel strongly about this because FORALL
is sort of a junk feature and this is an unlikely programming
style.  But, to be correct you should downgrade from ERROR
to WARNING for the message severity.

Dick Hendrickson

      program forall_warn
      integer  lda(10,10)

      FORALL(J1=1:10, J2=1:10,  J1 .EQ. J2) LDA(J1,J1) = 1


gfortran:gfortran forall_warn.f

      FORALL(J1=1:10, J2=1:10,  J1 .EQ. J2) LDA(J1,J1) = 1
Error: The FORALL with index 'j2' cause more than one assignment to this object
at (1)
Comment 1 Tobias Burnus 2008-03-30 21:27:35 UTC
Confirm. I agree that it is valid (although bad style) code.

I think there should be no warning printed if a index-name is used in the scalar-mask-expr. Otherwise, if it is neither used in the scalar-mask-expr nor in the forall-body-construct, I think it makes sense to print a warning; this is actually was ifort does.
Comment 2 Mikael Morin 2008-11-05 19:43:29 UTC
This was fixed by Paul in his patch for PR37445. 
Assigning to him.
Comment 3 Paul Thomas 2008-11-08 06:50:12 UTC
Fixed on trunk and 4.3.

Thanks for the report.