Patchwork [Fortran,OOP] PR 59414: Class array pointers: compile error on valid code (Different ranks in pointer assignment)

login
register
mail settings
Submitter Janus Weil
Date Dec. 7, 2013, 6:05 p.m.
Message ID <CAKwh3qj=0bxBeRODLuJVuFSM0gnhauZdtzEHiFymj64ZCMUfTA@mail.gmail.com>
Download mbox | patch
Permalink /patch/298705/
State New
Headers show

Comments

Janus Weil - Dec. 7, 2013, 6:05 p.m.
Hi all,

here is a small patch to fix a problem with class-array-valued
functions, where the rank was not determined properly. Regtestes on
x86_64-unknown-linux-gnu. Ok for trunk?

[Note: This patch only fixes the rejects-valid problem of comment 0/1,
but not the ICE of comment 2/3, which is a completely separate issue.]

Cheers,
Janus



2013-12-07  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/59414
    * resolve.c (resolve_specific_f0): Handle CLASS-valued functions.

2013-12-07  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/59414
    * gfortran.dg/class_result_2.f90: New.
Tobias Burnus - Dec. 7, 2013, 6:08 p.m.
Janus Weil wrote:
> here is a small patch to fix a problem with class-array-valued
> functions, where the rank was not determined properly. Regtestes on
> x86_64-unknown-linux-gnu. Ok for trunk?
>
> [Note: This patch only fixes the rejects-valid problem of comment 0/1,
> but not the ICE of comment 2/3, which is a completely separate issue.]

Looks good to me. Thanks for the patch!

Tobias

> 2013-12-07  Janus Weil  <janus@gcc.gnu.org>
>
>      PR fortran/59414
>      * resolve.c (resolve_specific_f0): Handle CLASS-valued functions.
>
> 2013-12-07  Janus Weil  <janus@gcc.gnu.org>
>
>      PR fortran/59414
>      * gfortran.dg/class_result_2.f90: New.
Janus Weil - Dec. 7, 2013, 7:28 p.m.
2013/12/7 Tobias Burnus <burnus@net-b.de>:
> Janus Weil wrote:
>>
>> here is a small patch to fix a problem with class-array-valued
>> functions, where the rank was not determined properly. Regtestes on
>> x86_64-unknown-linux-gnu. Ok for trunk?
>>
>> [Note: This patch only fixes the rejects-valid problem of comment 0/1,
>> but not the ICE of comment 2/3, which is a completely separate issue.]
>
>
> Looks good to me. Thanks for the patch!

Thanks for the review. Committed as r205785.

Cheers,
Janus

Patch

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 205782)
+++ gcc/fortran/resolve.c	(working copy)
@@ -2616,7 +2616,9 @@  found:
     expr->ts = sym->ts;
   expr->value.function.name = sym->name;
   expr->value.function.esym = sym;
-  if (sym->as != NULL)
+  if (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->as)
+    expr->rank = CLASS_DATA (sym)->as->rank;
+  else if (sym->as != NULL)
     expr->rank = sym->as->rank;
 
   return MATCH_YES;