public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Martin Jambor <mjambor@suse.cz>, GCC Patches <gcc-patches@gcc.gnu.org>
Cc: <fortran@gcc.gnu.org>
Subject: Re: [PATCH] Fortran: Fix generate_error library function fnspec
Date: Fri, 3 Nov 2023 14:22:22 +0100	[thread overview]
Message-ID: <c35623e7-1ceb-4ad2-b31d-e180de0f1520@codesourcery.com> (raw)
In-Reply-To: <ri6o7gb0zg6.fsf@>

On 03.11.23 13:54, Martin Jambor wrote:
> when developing an otherwise unrelated patch I've discovered that the
> fnspec for the Fortran library function generate_error is wrong. It is
> currently ". R . R " where the first R describes the first parameter
> and means that it "is only read and does not escape."  The function
> itself, however, with signature:
>
>    bool
>    generate_error_common (st_parameter_common *cmp, int family, const char *message)
>
> contains the following:
>
>    /* Report status back to the compiler.  */
>    cmp->flags &= ~IOPARM_LIBRETURN_MASK;
>
> which does not correspond to the fnspec and breaks testcase
> gfortran.dg/large_unit_2.f90 when my patch is applied, since it tries
> to re-use the flags from before the call.
>
> This patch replaces the "R" with "W" which stands for "specifies that
> the memory pointed to by the parameter does not escape."
>
> Bootstrapped and tested on x86_64-linux.  OK for master?

LGTM - thanks for the fix!

Tobias

> 2023-11-02  Martin Jambor  <mjambor@suse.cz>
>
>          * trans-decl.cc (gfc_build_builtin_function_decls): Fix fnspec of
>          generate_error.
>
> ---
>   gcc/fortran/trans-decl.cc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
> index a3f037bd07b..b86cfec7d49 100644
> --- a/gcc/fortran/trans-decl.cc
> +++ b/gcc/fortran/trans-decl.cc
> @@ -3821,7 +3821,7 @@ gfc_build_builtin_function_decls (void)
>       void_type_node, -2, pchar_type_node, pchar_type_node);
>
>     gfor_fndecl_generate_error = gfc_build_library_function_decl_with_spec (
> -     get_identifier (PREFIX("generate_error")), ". R . R ",
> +     get_identifier (PREFIX("generate_error")), ". W . R ",
>       void_type_node, 3, pvoid_type_node, integer_type_node,
>       pchar_type_node);
>
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  reply	other threads:[~2023-11-03 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 12:54 Martin Jambor
2023-11-03 13:22 ` Tobias Burnus [this message]
     [not found] <6544ed9e.050a0220.36ebf.0e8eSMTPIN_ADDED_BROKEN@mx.google.com>
2023-11-04  7:56 ` 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=c35623e7-1ceb-4ad2-b31d-e180de0f1520@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mjambor@suse.cz \
    /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).