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/99506] internal compiler error: in record_reference, at cgraphbuild.c:64
Date: Wed, 10 Mar 2021 16:52:20 +0000 [thread overview]
Message-ID: <bug-99506-4-4Jq8hhsNFH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99506-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99506
--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Mar 10, 2021 at 08:39:19AM +0000, rguenth at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99506
>
> --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
> This is a frontend issue, the FE produces an invalid static initializer for
> 'latt' (DECL_INITIAL):
>
> {(real(kind=8)) latt100[(integer(kind=8)) i + -1] / 1.0e+2, (real(kind=8))
> latt100[(integer(kind=8)) i + -1] / 1.0e+2,... }
>
> if this should be dynamic initialization FEs are responsible for lowering
> this.
>
> I don't know fortran enough for what 'parameter' means in this context:
>
> real(double), parameter:: latt(jmax) = [(latt100(i)/100.d0, j=1,jmax)]
>
> but the middle-end sees a readonly global (TREE_STATIC) variable.
>
'parameter' means that latt(jmax) is a named constant array.
Haven't thought about it too much, but for comparison, it should
be equivalent to C's 'static const latt[jmax] = {1, 2, ...}'.
This bug likely goes back to when g95 was initially added to GCC.
Implied-do loops are a rather special/odd construct. AFAI[CT|K],
gfortran has never done a proper checking of the ac-value-list
(See F2018, R773). Here, the ac-value is the expression
'latt100(i)', which must reduce to a constant expression because
the implied-do loop appears in an initialization expression.
Well, 'i' is an uninitialized variable, which certainly is not
constant.
next prev parent reply other threads:[~2021-03-10 16:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 6:32 [Bug fortran/99506] New: " furue at hawaii dot edu
2021-03-10 7:53 ` [Bug fortran/99506] " marxin at gcc dot gnu.org
2021-03-10 8:00 ` kargl at gcc dot gnu.org
2021-03-10 8:18 ` furue at hawaii dot edu
2021-03-10 8:39 ` rguenth at gcc dot gnu.org
2021-03-10 16:52 ` sgk at troutmask dot apl.washington.edu [this message]
2021-03-10 22:22 ` anlauf at gcc dot gnu.org
2021-03-10 22:59 ` sgk at troutmask dot apl.washington.edu
2021-03-11 1:38 ` sgk at troutmask dot apl.washington.edu
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-99506-4-4Jq8hhsNFH@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).