From: Jerry D <jvdelisle2@gmail.com>
To: Harald Anlauf <anlauf@gmx.de>, gcc-patches@gcc.gnu.org
Cc: fortran@gcc.gnu.org
Subject: Re: [patch, libgfortran] Part 2: PR105456 Child I/O does not propage iostat
Date: Wed, 6 Mar 2024 20:01:11 -0800 [thread overview]
Message-ID: <79209b29-a38c-41d6-bc4b-8448473f55de@gmail.com> (raw)
In-Reply-To: <466d3d24-8795-488d-96ac-edb2fc04676a@gmx.de>
On 3/6/24 9:13 AM, Harald Anlauf wrote:
> Hi Jerry,
>
> can you please replace the user message in e.g. your new testcase
> pr105456-wf.f90 by say:
>
> piomsg="The users message containing % and %% and %s and other stuff"
>
> This behaves as expected with Intel, but dies horribly with gfortran
> after your patch!
>
> Cheers,
> Harald
>
>
Fixed with:
commit 03932d3203bce244edd812b81921c2f16ea18d86 (HEAD -> master,
origin/master, origin/HEAD)
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date: Wed Mar 6 19:46:04 2024 -0800
Fortran: Fix issue with using snprintf function.
The previous patch used snprintf to set the message
string. The message string is not a formatted string
and the snprintf will interpret '%' related characters
as format specifiers when there are no associated
output variables. A segfault ensues.
This change replaces snprintf with a fortran string copy
function and null terminates the message string.
PR libfortran/105456
libgfortran/ChangeLog:
* io/list_read.c (list_formatted_read_scalar): Use fstrcpy
from libgfortran/runtime/string.c to replace snprintf.
(nml_read_obj): Likewise.
* io/transfer.c (unformatted_read): Likewise.
(unformatted_write): Likewise.
(formatted_transfer_scalar_read): Likewise.
(formatted_transfer_scalar_write): Likewise.
* io/write.c (list_formatted_write_scalar): Likewise.
(nml_write_obj): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr105456.f90: Revise using '%' characters
in users error message.
Jerry -
prev parent reply other threads:[~2024-03-07 4:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 5:29 Jerry D
2024-02-29 9:47 ` Bernhard Reutner-Fischer
2024-02-29 17:36 ` Jerry D
2024-02-29 18:13 ` Steve Kargl
[not found] ` <033ebcdd-6e25-4af7-9012-3338978751d8@gmail.com>
[not found] ` <05A1AEE6-6A68-4D4F-8BEA-6E87969E19E7@gmail.com>
2024-03-05 3:15 ` Jerry D
2024-03-05 21:30 ` rep.dot.nop
2024-03-05 21:37 ` Harald Anlauf
2024-03-05 21:37 ` Harald Anlauf
2024-03-05 21:51 ` Harald Anlauf
2024-03-05 21:51 ` Harald Anlauf
2024-03-06 4:06 ` Jerry D
2024-03-06 6:06 ` Steve Kargl
2024-03-06 17:13 ` Harald Anlauf
2024-03-06 17:13 ` Harald Anlauf
2024-03-07 4:01 ` Jerry D [this message]
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=79209b29-a38c-41d6-bc4b-8448473f55de@gmail.com \
--to=jvdelisle2@gmail.com \
--cc=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/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).