From: Thomas Koenig <tkoenig@netcologne.de>
To: Harald Anlauf <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR fortran/70070 - ICE on initializing character data beyond min/max bound
Date: Mon, 25 Jan 2021 19:58:55 +0100 [thread overview]
Message-ID: <3fe4244d-60b1-c7f1-10d2-4761428ca64f@netcologne.de> (raw)
In-Reply-To: <trinity-09564ecb-327d-451b-8e81-ced547aa785b-1611522719872@3c-app-gmx-bap45>
Hi Harald,
> the attached patch is pretty much self-explaining: check for bounds violation
> when initializing a substring in a data statement and treat the resulting error.
>
> If more detailed information should be emitted with the error message, I'm
> open for suggestions.
Currently, we issue these error messages in similar circumstances:
$ cat a.f90
character (len=3) :: a
a = 'abc'
print a(0:3)
print a(1:4)
end program
$ gfortran a.f90
a.f90:3:10:
3 | print a(0:3)
| 1
Error: Substring start index at (1) is less than one
a.f90:4:10:
4 | print a(1:4)
| 1
Error: Substring end index at (1) exceeds the string length
Could you maybe just re-use these?
> Regtested on x86_64-pc-linux-gnu.
>
> OK for master?
OK with adjusted error message. Thanks for the patch!
Best regards
Thomas
next prev parent reply other threads:[~2021-01-25 18:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-24 21:12 Harald Anlauf
2021-01-25 18:58 ` Thomas Koenig [this message]
2021-01-25 20:43 ` 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=3fe4244d-60b1-c7f1-10d2-4761428ca64f@netcologne.de \
--to=tkoenig@netcologne.de \
--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).