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

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Oct 18 11:37:00 GMT 2008



------- Comment #10 from burnus at gcc dot gnu dot org  2008-10-18 11:36 -------
Somehow reading the bug report first before replying helps ... Ignore the crap
I just wrote.

Dick's (comment 0)
      CALL MVBITS ((ILA1(NFV3)), 2, 4, ILA1, 3)       !fails
is valid as the first and the fourth argument don't refer to the same variable
- the first argument is an expression for which a temporary needs to be
created.

Ditto for FX's (comment 1)
  call mvbits ((ILA1((/9/))), 2, 4, ILA1, 3)

However, comment 7's
  CALL copy (a((/ 2, 1 /)), a)
is wrong as one passes twice the same variable - once as array section and once
as whole array. There an outer ( ... ) is missing which is needed to makes this
an expression.

For a lengthy answer including where to find it in the standard, see:

http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/160867d13fd90927/


Seemingly somewhere  (x)  is simplified to x (= EXPR_VARIABLE) and thus no
temporary is created - or something like that. For non-elemental procedures
this was fixed in gfortran 4.3; before foo((x),x) was optimized to foo((x),x).

One can probably ignore all examples after comment 1 and start with looking why
no temporary is created for comment 1 - afterwards one needs to check comment
0.


-- 


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



More information about the Gcc-bugs mailing list