[PR fortran/71862] Patch
Paul Richard Thomas
paul.richard.thomas@gmail.com
Fri Jul 22 20:07:00 GMT 2016
Hi Steve,
It looks good to me. OK to commit for as far back as you have a mind to go.
Cheers
Paul
On 22 July 2016 at 21:52, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
> I intend to commit the following patch and close the
> PR in approximate 6.283 hours.
>
> 2016-07-22 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/71862
> * class.c: Remove assert. Iterate over component only if non-null.
>
>
> 2016-07-22 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/71862
> * gfortran.dg/pr71862.f90: New test.
>
> Index: gcc/fortran/class.c
> ===================================================================
> --- gcc/fortran/class.c (revision 238665)
> +++ gcc/fortran/class.c (working copy)
> @@ -238,12 +238,14 @@ gfc_add_component_ref (gfc_expr *e, cons
> /* Avoid losing memory. */
> gfc_free_ref_list (*tail);
> c = gfc_find_component (derived, name, true, true, tail);
> - gcc_assert (c);
> - for (ref = *tail; ref->next; ref = ref->next)
> - ;
> - ref->next = next;
> - if (!next)
> - e->ts = c->ts;
> +
> + if (c) {
> + for (ref = *tail; ref->next; ref = ref->next)
> + ;
> + ref->next = next;
> + if (!next)
> + e->ts = c->ts;
> + }
> }
>
>
> Index: gcc/testsuite/gfortran.dg/pr71862.f90
> ===================================================================
> --- gcc/testsuite/gfortran.dg/pr71862.f90 (nonexistent)
> +++ gcc/testsuite/gfortran.dg/pr71862.f90 (working copy)
> @@ -0,0 +1,16 @@
> +! { dg-do compile }
> +program p
> + type t
> + integer :: n = 0
> + integer, pointer :: q => null()
> + end type
> + type(t) :: x
> + print *, associated(x%q)
> + x = f()
> + print *, associated(x%q)
> +contains
> + function f() result (z) ! { dg-error "must be dummy, allocatable or pointer" }
> + class(t) :: z
> + print *, associated(z%q)
> + end
> +end
>
> --
> Steve
--
The difference between genius and stupidity is; genius has its limits.
Albert Einstein
More information about the Fortran
mailing list