public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Paul Richard Thomas via Fortran <fortran@gcc.gnu.org>
Cc: rep.dot.nop@gmail.com,
	Paul Richard Thomas <paul.richard.thomas@gmail.com>,
	Harald Anlauf <anlauf@gmx.de>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	Steve Kargl <sgk@troutmask.apl.washington.edu>
Subject: Re: [Patch, fortran] PR107900 Select type with intrinsic type inside associate causes ICE / Segmenation fault
Date: Wed, 21 Jun 2023 21:17:47 +0200	[thread overview]
Message-ID: <20230621211747.7d4a0dc9@nbbrfq.loc> (raw)
In-Reply-To: <CAGkQGi+koDvyWRWYHqUpXLh7Wwk-p4zJnwDGHeNni4=1hrotxw@mail.gmail.com>

Hi!

First of all, many thanks for the patch!
If i may, i have a question concerning the chosen style in the error
message and one nitpick concerning a return type though, the latter
primarily prompting this reply.

On Tue, 20 Jun 2023 11:54:25 +0100
Paul Richard Thomas via Fortran <fortran@gcc.gnu.org> wrote:

> diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
> index d5cfbe0cc55..c960dfeabd9 100644
> --- a/gcc/fortran/expr.cc
> +++ b/gcc/fortran/expr.cc

> @@ -6470,6 +6480,22 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj,
>  	    }
>  	  return false;
>  	}
> +      else if (context && gfc_is_ptr_fcn (assoc->target))
> +	{
> +	  if (!gfc_notify_std (GFC_STD_F2018, "%qs at %L associated to "
> +			       "pointer function target being used in a "
> +			       "variable definition context (%s)", name,
> +			       &e->where, context))

I'm curious why you decided to put context in braces and not simply use
quotes as per %qs?

> +	    return false;
> +	  else if (gfc_has_vector_index (e))
> +	    {
> +	      gfc_error ("%qs at %L associated to vector-indexed target"
> +			 " cannot be used in a variable definition"
> +			 " context (%s)",
> +			 name, &e->where, context);

Ditto.

> diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
> index e7be7fddc64..0e4b5440393 100644
> --- a/gcc/fortran/match.cc
> +++ b/gcc/fortran/match.cc
> @@ -6377,6 +6377,39 @@ build_class_sym:
>  }
> 
> 
> +/* Build the associate name  */
> +static int
> +build_associate_name (const char *name, gfc_expr **e1, gfc_expr **e2)
> +{

> +    return 1;

> +  return 0;
> +}

I've gone through the frontend recently and changed several such
boolean functions to use bool where appropriate. May i ask folks to use
narrower types in new code, please?
Iff later in the pipeline it is considered appropriate or benefical to
promote types, these will eventually be promoted.

> diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
> index e6a4337c0d2..18589e17843 100644
> --- a/gcc/fortran/trans-decl.cc
> +++ b/gcc/fortran/trans-decl.cc

> @@ -1906,6 +1915,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
>  	gcc_assert (!sym->value || sym->value->expr_type == EXPR_NULL);
>      }
> 
> +

ISTM that the addition of vertical whitespace like here is in
contradiction with the coding style.

Please kindly excuse my comment and, again, thanks!

>    gfc_finish_var_decl (decl, sym);
> 
>    if (sym->ts.type == BT_CHARACTER)

  parent reply	other threads:[~2023-06-21 19:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17  9:14 Paul Richard Thomas
2023-06-17 15:33 ` Steve Kargl
2023-06-17 18:01 ` Harald Anlauf
2023-06-18  7:54   ` Paul Richard Thomas
2023-06-20 10:54     ` Paul Richard Thomas
2023-06-20 21:57       ` Harald Anlauf
2023-06-21 16:12         ` Paul Richard Thomas
2023-06-21 16:46           ` Steve Kargl
2023-06-21 18:40           ` Harald Anlauf
2023-06-21 19:17       ` Bernhard Reutner-Fischer [this message]
2023-06-22  6:19         ` Paul Richard Thomas

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=20230621211747.7d4a0dc9@nbbrfq.loc \
    --to=rep.dot.nop@gmail.com \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=paul.richard.thomas@gmail.com \
    --cc=sgk@troutmask.apl.washington.edu \
    /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).