https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94386

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Bill Seurer from comment #6)
> These were both clean builds run on a powerpc64 power8 LE machine.

I can confirm this on x86-64-gnu-linux; if I use the current trunk and undo
this commit, it works – with the patch, it fails.

 * * *

Looking it at in the debugger, one has:

   logical, parameter :: a(0) = .true.
   data d /a%kind/

In gfc_match_varspec, one has:

      if (tmp && tmp->type == REF_INQUIRY)

At this point, primary is "a" and primary->ref->next == tmp == tail while
primary->ref is the (full) array spec. Now one calls:

          gfc_simplify_expr (primary, 0);

which turns this into an EXPR_ARRAY and as this one cleans up, "tmp" now points
to undefined memory and fails.

Reply via email to