public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/103413] [10/11/12/13 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954
Date: Wed, 26 Oct 2022 19:05:47 +0000	[thread overview]
Message-ID: <bug-103413-4-6LkGjKlkNg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103413-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103413

--- Comment #12 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Oct 26, 2022 at 06:24:04PM +0000, anlauf at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103413
> 
> --- Comment #11 from anlauf at gcc dot gnu.org ---
> (In reply to kargl from comment #10)
> > Well, a boz is typeless, so it cannot be compatible with any other type.
> > So, I would assume, you could do 
> > 
> > if (ts1->type == BT_BOZ || ts2->type == BT_BOZ)
> >    return false;
> 
> Yes, that's better.
> 
> > There is a caveat in that Fortran 2023 is going to allow
> > things like
> > 
> >     real :: x = z'1234'
> > 
> > if gfc_type_compatible is used in simple assignments, gfortran will
> > need to deal with that.
> 
> It is currently not used in those cases.

Hmmm, I wonder if there is duplicate code within gfortran
that re-implements gfc_type_compatible.  If time permits, 
I'll see what comes with a grep of "->type == *->type".


> The following is already rejected:
> 
> program p
>   real :: r
>   data r / z'1234' /
>   r = z'1234'
>   print *, r
> end
> 
> pr103413-boz.f90:3:18:
> 
>     3 |   data r / z'1234' /
>       |                  1
> Error: BOZ literal constant near (1) cannot be assigned to a REAL variable [see
> '-fno-allow-invalid-boz']

F2018

If a data-stmt-constant is a boz-literal-constant, the corresponding
variable shall be of type integer.

F2023 is unchanged.

> pr103413-boz.f90:4:6:
> 
>     4 |   r = z'1234'
>       |      1
> Error: BOZ literal constant at (1) is neither a DATA statement value nor an
> actual argument of INT/REAL/DBLE/CMPLX intrinsic subprogram [see
> '-fno-allow-invalid-boz']

This I need to look up in F2023.  The statement may be allowed
only in an initialization expression.

> Interestingly, -fno-allow-invalid-boz is not an allowed option...
> But even when using -fallow-invalid-boz, which degrades the above
> to a warning, I never get to gfc_type_compatible.

The lack of -fno-allow-invalid-boz was intentional.  A BOZ in
an invalid context is an error.  -fallow-invalid-boz allows
that invalid context, but issues a warning.  The only way to
disable the warning is with -w (ie., you disable all warnings).

  parent reply	other threads:[~2022-10-26 19:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 17:46 [Bug fortran/103413] New: [10/11/12 Regression] ICE: Invalid expression in gfc_element_size gscfq@t-online.de
2021-11-24 18:15 ` [Bug fortran/103413] " kargl at gcc dot gnu.org
2021-11-24 23:21 ` kargl at gcc dot gnu.org
2021-11-25  7:17 ` rguenth at gcc dot gnu.org
2021-11-25  9:55 ` [Bug fortran/103413] [10/11/12 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954 marxin at gcc dot gnu.org
2022-06-28 10:47 ` [Bug fortran/103413] [10/11/12/13 " jakub at gcc dot gnu.org
2022-06-28 14:55 ` kargl at gcc dot gnu.org
2022-06-29  8:11 ` marxin at gcc dot gnu.org
2022-06-29 14:46 ` sgk at troutmask dot apl.washington.edu
2022-06-30 12:07 ` marxin at gcc dot gnu.org
2022-10-25 20:22 ` anlauf at gcc dot gnu.org
2022-10-25 21:44 ` kargl at gcc dot gnu.org
2022-10-26 18:24 ` anlauf at gcc dot gnu.org
2022-10-26 19:05 ` sgk at troutmask dot apl.washington.edu [this message]
2022-10-26 19:21 ` anlauf at gcc dot gnu.org
2022-10-26 19:22 ` anlauf at gcc dot gnu.org
2022-10-26 20:30 ` sgk at troutmask dot apl.washington.edu
2022-10-26 20:31 ` cvs-commit at gcc dot gnu.org
2022-10-28 20:38 ` cvs-commit at gcc dot gnu.org
2022-10-28 20:48 ` cvs-commit at gcc dot gnu.org
2022-10-28 20:57 ` cvs-commit at gcc dot gnu.org
2022-10-28 20:58 ` anlauf at gcc dot gnu.org

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=bug-103413-4-6LkGjKlkNg@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).