This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran, OOP] PR 54784: [4.7/4.8 Regression] wrong code in polymorphic allocation with SOURCE


Hi Mikael,

>> here is a small patch for a wrong-code regression with polymorphic
>> allocation. The problem is that we falsely detect the allocation
>> variable to be a polymorphic array (although it is a scalar). For
>> further details see the PR, in particular comment 4.
>>
>> Regtested on x86_64-unknown-linux-gnu. Ok for trunk and 4.7?
> Hello, the fix looks incomplete.
>
>>
>> Index: gcc/fortran/trans-stmt.c
>> ===================================================================
>> --- gcc/fortran/trans-stmt.c  (revision 192004)
>> +++ gcc/fortran/trans-stmt.c  (working copy)
>> @@ -5145,7 +5145,9 @@ gfc_trans_allocate (gfc_code * code)
>>             dataref = actual->next->expr->ref;
>>             /* Make sure we go up through the reference chain to
>>                the _data reference, where the arrayspec is found.  */
>> -           while (dataref->next && dataref->next->type != REF_ARRAY)
>> +           while (!(dataref->type == REF_COMPONENT
>> +                    && strcmp (dataref->u.c.component->name, "_data") == 0)
>> +                  && dataref->next)
> this stops on the first class reference, while it seems to me that it
> should stop on the last.

thanks for the review and sorry for taking so long to come back to it.

In fact I did not manage to come up with a test case where the patch
would fail, but maybe I just did not try hard enough. In any case,
please find attached a new version of the patch, which should make
sure to catch the *last* _data reference, not the first one.

Will commit to trunk after another regtest (and to 4.7 after a few
days). If you still see any problems with the patch, please let me
know.

Cheers,
Janus

Attachment: pr54784_v2.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]