[Patch, fortran] PR83344 - Use of uninitialized memory with ASSOCIATE and strings

Janne Blomqvist blomqvist.janne@gmail.com
Mon Feb 19 13:15:00 GMT 2018


On Mon, Feb 19, 2018 at 2:39 PM, Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
> Hi Janne,
>
> Please find attached a revised version of the patch that fixes all the
> issues that I know of.
>
> Regtests on FC27/x86_64 - OK for trunk?

1. The resolve.c part of the patch seems to have incorrect indentation?

2. Instead of gfc_index_zero_node would it be better to use
build_zero_cst (gfc_charlen_type_node)? Or is the same code used also
for something related to arrays? If so, probably safer to leave as is,
as the character length code should nowadays use fold_convert
relatively judiciously where needed.

3. For associate_36.f90, I believe that testcase was due to Steve
Kargl and not me.

4. I believe you can credit yourself with fixing PR 83975 as well in
the Changelog.

With these minor quibbles out of the way, Ok for trunk.

> I have also attached a test of all the failing cases in PR83975.
> However, I believe that they are all included in other associate*.f*.

Ok, fair enough. No need to test the same thing multiple times!

>
> Cheers
>
> Paul
>
> 2018-02-19  Paul Thomas  <pault@gcc.gnu.org>
>
>     PR fortran/83344
>     * resolve.c (resolve_assoc_var): Rearrange the logic for the
>     determination of the character length of associate names. If
>     the associate name is missing a length expression or the length
>     expression is not a constant and the target is not a variable,
>     make the associate name allocatable and deferred length.
>     * trans-decl.c (gfc_get_symbol_decl): Null the character length
>     backend_decl for deferred length associate names that are not
>     variables. Set 'length' to gfc_index_zero_node for character
>     associate names, whose character length is a PARM_DECL.
>
> 2018-02-19  Paul Thomas  <pault@gcc.gnu.org>
>
>     PR fortran/83344
>     * gfortran.dg/associate_22.f90: Enable commented out test.
>     * gfortran.dg/associate_36.f90: New test.
>
>
> On 18 February 2018 at 21:01, Paul Richard Thomas
> <paul.richard.thomas@gmail.com> wrote:
>> Hi Janne and Thomas,
>>
>> 1) The patch is attached now - sorry!
>>
>> 2) The commented out part of associate_22.f90 is not yet fixed. I am
>> working on it.
>>
>> 3) I will take a look at PR83975 tomorrow night.
>>
>> Paul
>>
>>
>> On 18 February 2018 at 16:08, Janne Blomqvist <blomqvist.janne@gmail.com> wrote:
>>> On Sun, Feb 18, 2018 at 5:48 PM, Paul Richard Thomas
>>> <paul.richard.thomas@gmail.com> wrote:
>>>> Bootstraps and regtests on FC27/x86_64 - OK for trunk?
>>>
>>> Hi,
>>>
>>> thanks for looking into this!
>>>
>>> 1. The patch itself is missing...
>>>
>>> 2. Could you uncomment the commented out part of associate_22.f90 and
>>> check that the tree-original dump is sensible.
>>>
>>> 3. Same for the testcases posted to PR 83975. I suspect (err, hope)
>>> that this patch would fix those as well. If so, please add that PR to
>>> the ChangeLog entries as well.
>>>
>>>>
>>>> Paul
>>>>
>>>> 2018-02-18  Paul Thomas  <pault@gcc.gnu.org>
>>>>
>>>>     PR fortran/83344
>>>>     * resolve.c (resolve_assoc_var): Character associate names that
>>>>     have no length expression that have variable targets and are
>>>>     not deferred length have assumed length.
>>>>     * trans-decl.c (gfc_get_symbol_decl): Set 'length' to
>>>>     gfc_index_zero_node for character associate names, whose string
>>>>     length is a PARM_DECL.
>>>>
>>>> 2018-02-18  Paul Thomas  <pault@gcc.gnu.org>
>>>>
>>>>     PR fortran/83344
>>>>     * gfortran.dg/associate_36.f90: New test.
>>>
>>>
>>>
>>> --
>>> Janne Blomqvist
>>
>>
>>
>> --
>> "If you can't explain it simply, you don't understand it well enough"
>> - Albert Einstein
>
>
>
> --
> "If you can't explain it simply, you don't understand it well enough"
> - Albert Einstein



-- 
Janne Blomqvist



More information about the Gcc-patches mailing list