* Fortran 2008 DATA statement restrictions
@ 2023-06-10 16:22 FX Coudert
2023-06-10 19:03 ` Harald Anlauf
0 siblings, 1 reply; 3+ messages in thread
From: FX Coudert @ 2023-06-10 16:22 UTC (permalink / raw)
To: Harald Anlauf via Fortran
[-- Attachment #1: Type: text/plain, Size: 975 bytes --]
Hi,
I was looking at our table for Fortran 2008 conformance (https://gcc.gnu.org/wiki/Fortran2008Status) and we really have only a few items missing. One in particular is: "Data statement restrictions lifted”.
Quoting the document:
> Subscripts and nested implied-do limits in a data statement can be any constant expression instead of being limited to combinations of constants, implied-do variables, and intrinsic operations.
Unless I misunderstand this quote, I think we have that already. Maybe we always had that? I have run the attached test program, which uses non-trivial constant expressions, and it passes fine.
So I plan to add that to our testsuite, and change the wiki. But I would like someone else to confirm: do you understand this the same way I do? Do you have ideas of other ways to test it, tricky expressions, etc? Are there other ways that "Subscripts and nested implied-do limits” may appear in a DATA statement?
Thanks,
FX
[-- Attachment #2: data.f90 --]
[-- Type: application/octet-stream, Size: 772 bytes --]
! { dg-do run }
!
! Checking for "The new features of Fortran 2008" feature 5.6
implicit none
integer :: a(6)
integer :: b(6)
integer(kind=4) :: i
! Fortran 2008: Subscripts in a data statement can be any constant expression
data a(kind("foo")) / 1 /
data a(sum([1, 2, 3]) / 3) / 2 /
data a(len("foo")) / 3 /
data a(kind(i)) / 4 /
data a(int(7.0 * atan(1.0)):6) / 5, 6 /
! Fortran 2008: nested implied-do limits in a data statement can be any constant expression
data (b(i), i = kind("foo"), sum([-1, 1, 2])) / 1, 2 /
data (b(i), i = len("foo"), kind(i)) / 3, 4 /
data (b(i), i = int(7.0 * atan(1.0)), 6) / 5, 6 /
! Check that data was correctly filled
if (any(a /= [(i, i = 1, 6)])) stop 1
if (any(b /= [(i, i = 1, 6)])) stop 1
end
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fortran 2008 DATA statement restrictions
2023-06-10 16:22 Fortran 2008 DATA statement restrictions FX Coudert
@ 2023-06-10 19:03 ` Harald Anlauf
2023-06-13 18:20 ` FX Coudert
0 siblings, 1 reply; 3+ messages in thread
From: Harald Anlauf @ 2023-06-10 19:03 UTC (permalink / raw)
To: FX Coudert, Harald Anlauf via Fortran
Hi FX!
Am 10.06.23 um 18:22 schrieb FX Coudert:
> Hi,
>
> I was looking at our table for Fortran 2008 conformance (https://gcc.gnu.org/wiki/Fortran2008Status) and we really have only a few items missing. One in particular is: "Data statement restrictions lifted”.
>
> Quoting the document:
>
>> Subscripts and nested implied-do limits in a data statement can be any constant expression instead of being limited to combinations of constants, implied-do variables, and intrinsic operations.
>
> Unless I misunderstand this quote, I think we have that already. Maybe we always had that? I have run the attached test program, which uses non-trivial constant expressions, and it passes fine.
>
> So I plan to add that to our testsuite, and change the wiki. But I would like someone else to confirm: do you understand this the same way I do? Do you have ideas of other ways to test it, tricky expressions, etc? Are there other ways that "Subscripts and nested implied-do limits” may appear in a DATA statement?
There is a meta-bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33056
and in particular one PR about vector subscripts:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49588
This one gives an ICE:
f951: internal compiler error: TODO: Vector sections in data statements
> Thanks,
> FX
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fortran 2008 DATA statement restrictions
2023-06-10 19:03 ` Harald Anlauf
@ 2023-06-13 18:20 ` FX Coudert
0 siblings, 0 replies; 3+ messages in thread
From: FX Coudert @ 2023-06-13 18:20 UTC (permalink / raw)
To: Harald Anlauf via Fortran; +Cc: Harald Anlauf
Hi,
Thanks Harald. I see there are bugs open, but actually not that many, compared to other areas of the compiler :)
I think the code I sent was not really covered in the testsuite, so I have committed it (after testing on x86_64-linux).
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a54c71ccc24874ce79019b51150b3a00b7c785cd
Best,
FX
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-13 18:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-10 16:22 Fortran 2008 DATA statement restrictions FX Coudert
2023-06-10 19:03 ` Harald Anlauf
2023-06-13 18:20 ` FX Coudert
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).