User account creation filtered due to spam.

Bug 51977 - [OOP] MOVE_ALLOC: Bogus "must have the same rank 0/1" for same-rank arrays
Summary: [OOP] MOVE_ALLOC: Bogus "must have the same rank 0/1" for same-rank arrays
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2012-01-24 08:11 UTC by Tobias Burnus
Modified: 2016-11-16 14:30 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2012-01-24 08:11:55 UTC
Split off from PR 51948.

The following fails at move_alloc with a bogus error:

  Error: the 'from' and 'to' arguments of 'move_alloc'  intrinsic at (1)
         must have the same rank 0/1


type t
end type t

contains
  function func(x)
    class(t), allocatable :: x(:), func(:)
    call move_alloc (x, func)
  end function
end
Comment 1 Tobias Burnus 2012-01-24 15:29:02 UTC
See also PR 51970, which has a similar issue - and contains a fix for the follow-up issue (trans-intrinsic.c's conv_intrinsic_move_alloc).
Comment 2 Tobias Burnus 2012-01-27 13:08:58 UTC
Author: burnus
Date: Fri Jan 27 13:08:52 2012
New Revision: 183622

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183622
Log:
2012-01-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51970
        PR fortran/51977
        * primary.c (gfc_match_varspec. gfc_match_rvalue): Set
        handle array spec for BT_CLASS.
        * expr.c (gfc_get_variable_expr, gfc_lval_expr_from_sym)
        * frontend-passes.c (create_var): Ditto.
        * resolve.c (resolve_actual_arglist, resolve_assoc_var): Ditto.
        * trans-decl.c (gfc_trans_deferred_vars): Use class_pointer
        instead of attr.pointer.
        (gfc_generate_function_code): Use CLASS_DATA (sym) for BT_CLASS.
        * trans-intrinsic.c (conv_intrinsic_move_alloc): Move assert.
        * trans-stmt.c (trans_associate_var): Ask for the descriptor.

2012-01-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51970
        PR fortran/51977
        * gfortran.dg/move_alloc_13.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/move_alloc_13.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/frontend-passes.c
    trunk/gcc/fortran/primary.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Tobias Burnus 2012-01-27 13:10:00 UTC
FIXED on the trunk (4.7).