public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: Paul Richard Thomas <paul.richard.thomas@gmail.com>,
	Harald Anlauf <anlauf@gmx.de>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: Re: [PATCH] PR fortran/99112 - [11 Regression] ICE with runtime diagnostics for SIZE intrinsic function
Date: Sun, 14 Mar 2021 11:56:43 +0100	[thread overview]
Message-ID: <e876c57f-b6ad-83ce-b4d7-b2287b3b7350@net-b.de> (raw)
In-Reply-To: <CAGkQGiKO0=nJQ6--2QO=+jE74ec7dH=6JCoLbNzf+r0oJjYX4Q@mail.gmail.com>

Hi Harald, hi Paul,

On 13.03.21 09:58, Paul Richard Thomas via Fortran wrote:
> I am not sure of the etiquette for this - it looks OK to me :-)

:-)

On Fri, 12 Mar 2021 at 21:20, Harald Anlauf via Fortran 
<fortran@gcc.gnu.org>

> the addition of runtime checks for the SIZE intrinsic created a regression
> that showed up for certain CLASS arguments to procedures.  Paul did most of
> the work (~ 99%), but asked me to dig into an issue with an inappropriately
> selected error message.  This actually turned out to be a simple one-liner
> on top of Paul's patch.
>
> Regtested on x86_64-pc-linux-gnu.  OK for mainline?

The procedure-call patch looks good to me, except for:
> --- a/gcc/fortran/trans-expr.c
> +++ b/gcc/fortran/trans-expr.c
> @@ -6662,6 +6662,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
> [...]
> +	  tree temp;
> ...
> -	      tmp = parmse.expr;
> +	      if (fsym && fsym->ts.type == BT_CLASS)
> +		{
> +		  temp = build_fold_indirect_ref_loc (input_location,
> ...
> +	      else
> +		temp = parmse.expr;
> ...
> -	      if (!POINTER_TYPE_P (TREE_TYPE (parmse.expr)))
> -		tmp = gfc_build_addr_expr (NULL_TREE, tmp);
> +	      if (!POINTER_TYPE_P (TREE_TYPE (temp)))
> +		temp = gfc_build_addr_expr (NULL_TREE, temp);
> ...
> -				      logical_type_node, tmp,
> -				      fold_convert (TREE_TYPE (tmp),
> +				      logical_type_node, temp,
> +				      fold_convert (TREE_TYPE (temp)

I do not see any reason why 'tmp' is replaced by 'temp' in this
code. Also for doing patch archeology, it helps if there are no
changes unless it makes sense. Adding an -e- does not count ;-)

Hence, OK with that change.

  * * *

Regarding the change:
  gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr)

It looks as if the pointer/check is done for
   size(dt%foo%bar)
for the 'bar' component' but shouldn't it also be
done for each part ref, if it is a pointer/allocatable?
(i.e. 'dt', 'foo' and 'bar'?

That's independent of the current patch.

Additionally, as there are a lot of special cases for
CLASS – I wonder whether there also needs to be a special
case for
   size(dt%foo%class)
?

In particular, the following does ICE for me:

module m
   type t
     class(*), pointer :: bar(:)
   end type
   type t2
     class(t), allocatable :: my(:)
   end type t2
contains
   function f (x, y) result(z)
     class(t) :: x(:)
     class(t) :: y(size(x(1)%bar))
     type(t)  :: z(size(x(1)%bar))
   end
   function g (x) result(z)
     class(t) :: x(:)
     type(t)  :: z(size(x(1)%bar))
   end
   subroutine s ()
     class(t2), allocatable :: a(:), b(:), c(:), d(:)
     class(t2), pointer     :: p(:)
     c(1)%my = f (a(1)%my, b(1)%my)
     d(1)%my = g (p(1)%my)
   end
end

  * * *
  

> P.S.: I couldn't find a Changelog entry that uses co-authors.  Is the
> version
> below correct?
...
> Co-authored-by: Paul Thomas  <pault@gcc.gnu.org>

I think you have two options: either the GIT way – as you did (although I think the
GIT way usually only has one and not two spaces before the email).

I did not see it in the commit logs, but it is used in the
testcases for the change-log generator, see: contrib/gcc-changelog/test_patches.txt

Alternative way is to specify the authors in the classical
ChangeLog style; latest real-world example is
https://gcc.gnu.org/g:d656bfda2d8316627d0bbb18b10954e6aaf3c88c
but you can also look at the contrib/gcc-changelog/test_patches.txt

Finally, you can also run the script at contrib/gcc-changelog/ yourself
as pre-commit check.
For instance, if you committed but did not yet push it:
  git show -1 | ./contrib/gcc-changelog/git_check_commit.py -p
to errors there, you can use 'git commit --amend' until you have
pushed that commit (then it is too late).

Tobias


  reply	other threads:[~2021-03-14 10:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 20:43 Harald Anlauf
2021-03-13  8:58 ` Paul Richard Thomas
2021-03-14 10:56   ` Tobias Burnus [this message]
2021-03-14 19:54     ` Aw: " Harald Anlauf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e876c57f-b6ad-83ce-b4d7-b2287b3b7350@net-b.de \
    --to=burnus@net-b.de \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=paul.richard.thomas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).