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
* [Bug fortran/114023] complex part%ref of complex named constant array cannot be used in an initialization expression.
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 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2024-02-21 19:04 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/114023] complex part%ref of complex named constant array cannot be used in an initialization expression.
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
2 siblings, 0 replies; 4+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2024-03-13 18:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114023
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2024-03-13
--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Steve, Anuj is interested in digging in on this one. This will be a learning
experience.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/114023] complex part%ref of complex named constant array cannot be used in an initialization expression.
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
2 siblings, 0 replies; 4+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2024-03-13 18:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114023
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Mar 13, 2024 at 06:02:58PM +0000, jvdelisle at gcc dot gnu.org wrote:
>
> --- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> Steve, Anuj is interested in digging in on this one. This will be a learning
> experience.
>
That's fine with. If Anuj or you have questions or
want me to look at something, just ping me.
^ 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).