[Patch] PR fortran/93366 - ICE on invalid, reject invalid use of NULL() as argument

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Patch] PR fortran/93366 - ICE on invalid, reject invalid use of NULL() as argument

Harald Anlauf-3
The attached patch fixes a couple of cases where an invalid NULL() argument
provided to intrinsics produced either an ICE or was silently accepted.
We now reject them.

Steve Kargl provided an initial version, which I extended to catch a few
more cases.

Regtests with no new failures on x86_64-pc-linux-gnu.  OK for master?

Thanks,
Harald

2020-05-04  Steve Kargl  <[hidden email]>
        Harald Anlauf  <[hidden email]>

        PR fortran/93366
        * check.c (gfc_check_associated, invalid_null_arg): Factorize
        check for presence of invalid NULL() argument.
        (gfc_check_kind, gfc_check_merge, gfc_check_shape)
        (gfc_check_sizeof, gfc_check_spread, gfc_check_transfer): Use this
        check for presence of invalid NULL() arguments.


2020-05-04  Harald Anlauf  <[hidden email]>

        PR fortran/93366
        * gfortran.dg/pr93366.f90: New test.


pr93366-patch (3K) Download Attachment
pr93366-testcase-patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Aw: Re: [Patch] PR fortran/93366 - ICE on invalid, reject invalid use of NULL() as argument

Harald Anlauf-3
Hi Tobias,

> Two points regarding future patches:
>
> Please attach files with a file suffix – such that the MIME
> type is "text/..." and not "application/octet-stream".
> (.patch, .diff or even a simple .txt should do.)

noted.

> Additionally, given that we now use GIT and start to move
> to autogenerating changelogs, can you post the commit-log
> text instead of (only) the changelog entry?
> See: https://gcc.gnu.org/pipermail/gcc/2020-April/thread.html#500
> ("Automatically generated ChangeLog files")
> and follow-up in May
> https://gcc.gnu.org/pipermail/gcc/2020-April/000500.html

The current git workflow for gcc is IMO a PITA.  Hopefully somebody
writes a wiki entry with best practices, so that fortran developers
do not have to dig in the gcc archives.

Automatic generation of ChangeLog files could have been considered
as part of the transition svn->git.

> Regarding the patch:
>
> +      gfc_error ("NULL pointer at %L is not permitted as actual argument "
> +                "of %qs intrinsic function", &x->where,
>
> I wonder whether "argument of" should be rather "argument to" and
> "NULL pointer" should be "NULL" as Fortran only talks about
> "disassociated" pointers etc. and not about NULL pointers.
> (I know that this is unchanged from the original code.)

Done.  See below.

> Otherwise it LGTM.
>
> Tobias

Thanks for the review!

Harald


Here's what I actually committed.  Hopefully this is close to what it should be...


PR fortran/93366 - ICE on invalid, reject invalid use of NULL() as argument

gcc/fortran/ChangeLog:

2020-05-05  Steve Kargl  <[hidden email]>
        Harald Anlauf  <[hidden email]>

        PR fortran/93366
        * check.c (gfc_check_associated, invalid_null_arg): Factorize
        check for presence of invalid NULL() argument.
        (gfc_check_kind, gfc_check_merge, gfc_check_shape)
        (gfc_check_sizeof, gfc_check_spread, gfc_check_transfer): Use this
        check for presence of invalid NULL() arguments.

gcc/testsuite/ChangeLog:

2020-05-05  Harald Anlauf  <[hidden email]>

        PR fortran/93366
        * gfortran.dg/pr93366.f90: New test.

pr93366.patch (5K) Download Attachment