From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Mikael Morin <morin-mikael@orange.fr>
Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org,
Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Subject: Re: [PATCH v2] Fortran: Narrow return types [PR78798]
Date: Thu, 18 May 2023 21:52:20 +0200 [thread overview]
Message-ID: <20230518215220.26f4bd3d@nbbrfq.loc> (raw)
In-Reply-To: <bfc5cc66-7ce7-0f6b-3c1a-e29f7978e6fc@orange.fr>
On Sun, 14 May 2023 14:27:42 +0200
Mikael Morin <morin-mikael@orange.fr> wrote:
> Le 10/05/2023 à 18:47, Bernhard Reutner-Fischer via Fortran a écrit :
> > From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
> >
> > gcc/fortran/ChangeLog:
> >
> > PR fortran/78798
> > * array.cc (compare_bounds): Use narrower return type.
> > (gfc_compare_array_spec): Likewise.
> > (is_constant_element): Likewise.
> > (gfc_constant_ac): Likewise.
> (...)
> > ---
> > Bootstrapped without new warnings and regression tested on
> > x86_64-linux with no regressions, OK for trunk?
> >
> (...)
> > diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
> > index b348bda6e6c..4e3aed84b9d 100644
> > --- a/gcc/fortran/check.cc
> > +++ b/gcc/fortran/check.cc
> > @@ -1156,7 +1156,7 @@ dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
> > dimension bi, returning 0 if they are known not to be identical,
> > and 1 if they are identical, or if this cannot be determined. */
> >
> > -static int
> > +static bool
> > identical_dimen_shape (gfc_expr *a, int ai, gfc_expr *b, int bi)
> > {
> > mpz_t a_size, b_size;
>
> To be consistent, please change as well the local variable "ret" used as
> return value from int to bool.
>
> > diff --git a/gcc/fortran/cpp.cc b/gcc/fortran/cpp.cc
> > index c3b7c7f7bd9..d7890a97287 100644
> > --- a/gcc/fortran/cpp.cc
> > +++ b/gcc/fortran/cpp.cc
> > @@ -297,7 +297,7 @@ gfc_cpp_init_options (unsigned int decoded_options_count,
> > gfc_cpp_option.deferred_opt_count = 0;
> > }
> >
> > -int
> > +bool
> > gfc_cpp_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
> > {
> > int result = 1;
>
> Same here, change the type of variable "result".
>
> (...)
> > diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc
> > index a648d5c7903..b398b29a642 100644
> > --- a/gcc/fortran/dependency.cc
> > +++ b/gcc/fortran/dependency.cc
> (...)
>
> > @@ -1091,7 +1091,7 @@ gfc_check_argument_dependency (gfc_expr *other, sym_intent intent,
> > /* Like gfc_check_argument_dependency, but check all the arguments in ACTUAL.
> > FNSYM is the function being called, or NULL if not known. */
> >
> > -int
> > +bool
> > gfc_check_fncall_dependency (gfc_expr *other, sym_intent intent,
> > gfc_symbol *fnsym, gfc_actual_arglist *actual,
> > gfc_dep_check elemental)
>
> Why not change the associated subfunctions
> (gfc_check_argument_dependency, gfc_check_argument_var_dependency) as well ?
I have left these subfunctions alone for now to get the other hunks out
of the way. I have adjusted the patch according to your other comments
and pushed it as r14-973-gc072df1ab14450.
Thanks!
>
> (...)
> > @@ -2098,7 +2098,7 @@ ref_same_as_full_array (gfc_ref *full_ref, gfc_ref *ref)
> > there is some kind of overlap.
> > 0 : array references are identical or not overlapping. */
> >
> > -int
> > +bool
> > gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
> > bool identical)
> > {
>
> The function comment states that the function may return 2, which
> doesn't seem to be the case any more. So please update the comment.
>
> (...)> diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
> > index 221165d6dac..b4b36e27d75 100644
> > --- a/gcc/fortran/symbol.cc
> > +++ b/gcc/fortran/symbol.cc
> > @@ -3216,7 +3216,7 @@ gfc_find_symtree_in_proc (const char* name, gfc_namespace* ns)
> > any parent namespaces if requested by a nonzero parent_flag.
> > Returns nonzero if the name is ambiguous. */
> >
> > -int
> > +bool
> > gfc_find_sym_tree (const char *name, gfc_namespace *ns, int parent_flag,
> > gfc_symtree **result)
> > {
>
> Maybe change nonzero to true in the comment?
>
> (...)
>
> OK with all the above fixed.
>
> Thanks.
>
next prev parent reply other threads:[~2023-05-18 19:52 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-12 23:45 [PATCH 0/5] function result decl location; type demotion Bernhard Reutner-Fischer
2022-11-12 23:45 ` [PATCH 1/5] c: Set the locus of the function result decl Bernhard Reutner-Fischer
2022-11-14 21:25 ` Joseph Myers
2022-11-12 23:45 ` [PATCH 2/5] c++: " Bernhard Reutner-Fischer
2022-11-15 23:52 ` Jason Merrill
2022-11-17 8:56 ` Bernhard Reutner-Fischer
2022-11-17 14:53 ` Jason Merrill
2022-11-17 19:02 ` Bernhard Reutner-Fischer
2022-11-17 23:52 ` Jason Merrill
2022-11-18 10:49 ` Bernhard Reutner-Fischer
2022-11-18 16:06 ` Jason Merrill
2022-11-18 18:26 ` Bernhard Reutner-Fischer
2022-11-19 9:56 ` Bernhard Reutner-Fischer
2022-11-20 17:06 ` Bernhard Reutner-Fischer
2022-11-22 20:25 ` Jason Merrill
2022-11-23 15:28 ` Jason Merrill
2022-12-02 19:30 ` Jason Merrill
2022-12-02 19:55 ` Bernhard Reutner-Fischer
2022-11-12 23:45 ` [PATCH 3/5] Fortran: Narrow return types [PR78798] Bernhard Reutner-Fischer
2022-11-13 10:13 ` Janne Blomqvist
2022-11-13 10:39 ` Bernhard Reutner-Fischer
2022-11-13 20:29 ` Harald Anlauf
2022-11-13 20:29 ` Harald Anlauf
2022-11-13 21:50 ` Bernhard Reutner-Fischer
2023-05-10 16:47 ` [PATCH v2] " Bernhard Reutner-Fischer
2023-05-14 12:27 ` Mikael Morin
2023-05-14 13:04 ` Thomas Koenig
2023-05-14 15:24 ` Bernhard Reutner-Fischer
2023-05-14 18:06 ` Mikael Morin
2023-05-18 19:52 ` Bernhard Reutner-Fischer [this message]
2022-11-12 23:45 ` [PATCH 4/5] value-range: Add as_string diagnostics helper Bernhard Reutner-Fischer
2022-11-12 23:55 ` Andrew Pinski
2022-11-17 3:30 ` Jeff Law
2022-11-12 23:45 ` [PATCH 5/5] gimple: Add pass to note possible type demotions; IPA pro/demotion; DO NOT MERGE Bernhard Reutner-Fischer
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=20230518215220.26f4bd3d@nbbrfq.loc \
--to=rep.dot.nop@gmail.com \
--cc=aldot@gcc.gnu.org \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=morin-mikael@orange.fr \
/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).