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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org 2010-12-17 23:15:27 UTC ---
The issues appears to have come into gfortran with pault's
initial commit of Brook's gfc_simplify_transfer.  This
is revision 124759.

Consider 

program z
  use iso_c_binding
  type(c_ptr) m
  m = transfer(12345, m)
end program z

The culprit is the second test in 

  if (!gfc_is_constant_expr (source)
    || (gfc_init_expr_flag && !gfc_is_constant_expr (mold))
    || !gfc_is_constant_expr (size))
    return NULL;

Here, gfc_init_expr_flag = 0 and mold is EXPR_VARIABLE, which
yields !gfc_is_constant_expr (mold) = 1.  Clearly (0 && anything)
is going to be 0. So, gfortran tries to simplify the expression.

If gfc_init_expr_flag is removed, the code compiles.

Anyone know why this flag is needed?

Reply via email to