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] New: complex part%ref of complex named constant array cannot be used in an initialization expression.
Date: Tue, 20 Feb 2024 21:30:48 +0000	[thread overview]
Message-ID: <bug-114023-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 114023
           Summary: complex part%ref of complex named constant array
                    cannot be used in an initialization expression.
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kargl at gcc dot gnu.org
  Target Milestone: ---

Found with the Fujitsu testsuite.  The original code led to
an ICE, but the modified version here compiles and executes.
It is however wrong-code as the testcase stops at STOP 1.

!
! https://github.com/fujitsu/compiler-test-suite
! Modified from Fortran/0093/0093_0025.f90
!
   complex(kind=8),  parameter :: cmp1(3) = [(1,2),(3,4),(5,6)]
   complex(kind=16), parameter :: cmp2(3) = [(1,2),(3,4),(5,6)]

   real(8)  :: rr(3) = cmp1%re
   real(8)  :: qq(3) = cmp1%im
   real(16) :: rr2(3) = cmp2%re
   real(16) :: qq2(3) = cmp2%im

   if (any(int(rr)  /= [1,3,5])) stop 1
   if (any(int(qq)  /= [2,4,6])) stop 2
   if (any(int(rr2) /= [1,3,5])) stop 3
   if (any(int(qq2) /= [2,4,6])) stop 4

end

Modifying the code to output rr shows
% gfcx -o z 0093/0093_0036.f90 && ./z
   1.0000000000000000        2.0000000000000000        0.0000000000000000

             reply	other threads:[~2024-02-20 21:30 UTC|newest]

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