[patch, fortran] Fix PR PR93500

Fritz Reese fritzoreese@gmail.com
Fri Apr 17 19:39:35 GMT 2020


On Fri, Apr 17, 2020 at 10:33 AM Thomas Koenig <tkoenig@netcologne.de> wrote:
>
> Hi Fritz,
>
> > First, it appears if simplify_bound_dim returns &gfc_bad_expr (and a
> > div/0 occurs) then this code will free &gfc_bad_expr. I'm not sure
> > whether or not that can actually occur, but it is certainly incorrect,
> > since &gfc_bad_expr points to static storage. The only other possible
> > case is bounds[d] == NULL, in which case the free is a no-op. I
> > suggest removing the free call.
>
> OK, removed.
>
> > That being said, it looks like the same error condition can occur with
> > the lcobound intrinsic.
>
> I have adjusted the test case so it also checks for the coarray case;
> this is handled correctly with a "Divion by zero" error without
> changing the patch in that respect.
>
> So, anything else?  If not, I will commit this within a few days.
>

Let the record show I am unsettled that the error path is different
between simplify_bound and simplify_cobound, and that different errors
occur for the program and subroutine case. There is probably a root
cause somewhere else that should be fixed one day. However! That is
not a problem for this PR, nor for stage 4, and is certainly no fault
of this patch. Therefore the patch looks OK to me for now. Thank you
for your work!

---
Fritz Reese


More information about the Gcc-patches mailing list