public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114023] New: complex part%ref of complex named constant array cannot be used in an initialization expression.
@ 2024-02-20 21:30 kargl at gcc dot gnu.org
  2024-02-21 19:04 ` [Bug fortran/114023] " kargl at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2024-02-20 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-13 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 21:30 [Bug fortran/114023] New: complex part%ref of complex named constant array cannot be used in an initialization expression kargl at gcc dot gnu.org
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

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).