[Bug fortran/35681] wrong result for vector subscripted array expression in MVBITS

pault at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Oct 19 14:35:00 GMT 2008



------- Comment #12 from pault at gcc dot gnu dot org  2008-10-19 14:34 -------
To put the arguments succinctly, this is a double problem (apart from the
conformity issue):

(i) The original test case is losing the EXPR_PARENTHESES for some reason.  ie.
there is no question that in this case a temporary should be made for the
'FROM' actual argument.

(ii) 12.7.3    Elemental subroutine actual arguments
"An elemental subroutine is one that has only scalar dummy arguments, but may
have array actual arguments. In a reference to an elemental subroutine, either
all actual arguments shall be scalar, or all actual arguments associated with
INTENT (OUT) and INTENT (INOUT) dummy arguments shall be arrays of the same
shape and the remaining actual arguments shall be conformable with them. In the
case that the actual arguments associated with INTENT (OUT) and INTENT (INOUT)
dummy arguments are arrays, the values of the elements, if any, of the results
are the same as would be obtained if the subroutine had been applied
separately, in any order, to corresponding elements of each array actual
argument. In a reference to the intrinsic subroutine MVBITS, the actual
arguments corresponding to the TO and FROM dummy arguments may be the same
variable. Apart from this, the actual arguments in a reference to an elemental
subroutine must satisfy the restrictions of 12.4.1.6."

Since the 'TO' and 'FROM' arguments can alias in MVBITS and the results must be
order independent, the test case should also create a temporary, even without
enclosing parentheses.  For the reason described before
trans-stmt.c(gfc_conv_elemental_dependencies) this should be the 'TO' variable
and should be done on the basis of a dependency between 'TO' and 'FROM' to be
safe.

The implementation is complicated by the resolved_sym for MVBITS not carrying
formal arguments so that gfc_conv_elemental_dependencies does nothing, even if
it is "spoon-fed" the call.

Paul puts thinking hat on!


-- 


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



More information about the Gcc-bugs mailing list