[Patch, Fortran, OOP] PR 64230: [4.9/5 Regression] Invalid memory reference in a compiler-generated finalizer for allocatable component
Janus Weil
janus@gcc.gnu.org
Sat Jan 24 10:49:00 GMT 2015
ping!
2015-01-19 15:41 GMT+01:00 Janus Weil <janus@gcc.gnu.org>:
> Hi,
>
> this is a second patch dealing with finalization-related regressions,
> after the one I submitted yesterday
> (https://gcc.gnu.org/ml/fortran/2015-01/msg00109.html), which btw is
> also still waiting for review ...
>
> This patch fixes an invalid memory reference inside the finalizer
> routine (at runtime), which apparently was caused by dereferencing a
> pointer without checking if it's NULL. I simply insert a call to
> ASSOCIATED.
>
> I also rename two different runtime variables, which were both called
> 'ptr', to 'ptr1' and 'ptr2', just to make it easier to distinguish
> them in the dump.
>
> I also have the feeling the a lot of what is being done in
> generate_finalization_wrapper and finalize_component (including my
> changes) is a bit laborious. Some helper functions might be useful to
> make all that code generation a bit more readable and less verbose. I
> may attack this in a follow-up patch.
>
> This one regtests cleanly on x86_64-unknown-linux-gnu. Ok for trunk and 4.9?
>
> Cheers,
> Janus
>
>
>
> 2015-01-19 Janus Weil <janus@gcc.gnu.org>
>
> PR fortran/64230
> * class.c (finalize_component): New argument 'sub_ns'. Insert code to
> check if 'expr' is associated.
> (generate_finalization_wrapper): Rename 'ptr' symbols to 'ptr1' and
> 'ptr2'. Pass 'sub_ns' to finalize_component.
>
> 2015-01-19 Janus Weil <janus@gcc.gnu.org>
>
> PR fortran/64230
> * gfortran.dg/class_allocate_18.f90: Extended.
More information about the Gcc-patches
mailing list