public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/114023] complex part%ref of complex named constant array cannot be used in an initialization expression.
Date: Wed, 21 Feb 2024 19:04:04 +0000	[thread overview]
Message-ID: <bug-114023-4-FXziEEh1Al@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114023-4@http.gcc.gnu.org/bugzilla/>

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

--- Comment #1 from kargl at gcc dot gnu.org ---
This one is a bit uglier.  For the testcase,


program foo

   implicit none

   complex(kind=8), parameter :: cmp1(3) = [(1,2),(3,4),(5,6)]

   real :: rr(3) = cmp1%re

   if (any(int(rr) /= [1,3,5])) then
      print '(3(F4.1))', rr
      stop 1
   end if

end

one gets an ICE

% gfcx -o z a.f90 && ./z
a.f90:5:11:

    5 | program foo
      |           1
internal compiler error: in gfc_conv_array_initializer, at
fortran/trans-array.cc:6662
0x6eb2cf gfc_conv_array_initializer(tree_node*, gfc_expr*)
        ../../gccx/gcc/fortran/trans-array.cc:6662

This caused by the insertion of a conversion function __convert_r8_r4()
into the initializer where gfc_conv_array_initializer() is not prepared
to hand it.  Now, if the type declaration of rr is changed to 'real(8)',
then a conversion function is not inserted but wrong code is generated.
I suspect that we need to go code spelunking in resolve.cc.

  reply	other threads:[~2024-02-21 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 21:30 [Bug fortran/114023] New: " kargl at gcc dot gnu.org
2024-02-21 19:04 ` kargl at gcc dot gnu.org [this message]
2024-03-13 18:02 ` [Bug fortran/114023] " jvdelisle at gcc dot gnu.org
2024-03-13 18: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-114023-4-FXziEEh1Al@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).