public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101735] New: Type parameter inquiries for substrings are rejected
@ 2021-08-02 21:08 anlauf at gcc dot gnu.org
2021-08-02 21:13 ` [Bug fortran/101735] " anlauf at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-08-02 21:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101735
Bug ID: 101735
Summary: Type parameter inquiries for substrings are rejected
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
As noted by Tobias Burnus in pr100950, type parameter inquiries
(see e.g. F2018:9.4.5) are not recognized for substrings.
character(len=5) :: str
integer, parameter :: j = str% kind ! accepted (ok)
integer, parameter :: k = str% len ! accepted (ok)
integer, parameter :: l = str(1:3)% len ! not accepted
integer, parameter :: m = str(1:3)% kind ! not accepted
end
gives:
pr100950-inq.f90:4:25:
4 | integer, parameter :: l = str(1:3)% len ! not accepted
| 1
Error: Parameter 'str' at (1) has not been declared or is a variable, which
does not reduce to a constant expression
pr100950-inq.f90:5:25:
5 | integer, parameter :: m = str(1:3)% kind ! not accepted
| 1
Error: Parameter 'str' at (1) has not been declared or is a variable, which
does not reduce to a constant expression
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/101735] Type parameter inquiries for substrings are rejected
2021-08-02 21:08 [Bug fortran/101735] New: Type parameter inquiries for substrings are rejected anlauf at gcc dot gnu.org
@ 2021-08-02 21:13 ` anlauf at gcc dot gnu.org
2021-08-02 21:35 ` kargl at gcc dot gnu.org
2021-08-19 6:43 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-08-02 21:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101735
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-08-02
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from anlauf at gcc dot gnu.org ---
Furthermore:
character(len=5) :: str
print *, str% len ! accepted (ok)
print *, str(1:3)% len ! syntax error!?
end
produces:
pr101735-tb.f90:3:18:
3 | print *, str(1:3)% len ! syntax error!?
| 1
Error: Syntax error in PRINT statement at (1)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/101735] Type parameter inquiries for substrings are rejected
2021-08-02 21:08 [Bug fortran/101735] New: Type parameter inquiries for substrings are rejected anlauf at gcc dot gnu.org
2021-08-02 21:13 ` [Bug fortran/101735] " anlauf at gcc dot gnu.org
@ 2021-08-02 21:35 ` kargl at gcc dot gnu.org
2021-08-19 6:43 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-08-02 21:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101735
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to anlauf from comment #1)
> Furthermore:
>
> character(len=5) :: str
> print *, str% len ! accepted (ok)
> print *, str(1:3)% len ! syntax error!?
> end
>
> produces:
>
> pr101735-tb.f90:3:18:
>
> 3 | print *, str(1:3)% len ! syntax error!?
> | 1
> Error: Syntax error in PRINT statement at (1)
I think it is a bug in gfortran. F2018 shows designator % type-param-name
with blanks around %. For fixed-form source code, blanks are irrelevant.
For free-form source code, 6.3.2.2 has "Blanks may be inserted freely between
tokens to improve readability; for example, blanks may occur between the
tokens that form a complex literal constant."
So, I would think we treat % as a token.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/101735] Type parameter inquiries for substrings are rejected
2021-08-02 21:08 [Bug fortran/101735] New: Type parameter inquiries for substrings are rejected anlauf at gcc dot gnu.org
2021-08-02 21:13 ` [Bug fortran/101735] " anlauf at gcc dot gnu.org
2021-08-02 21:35 ` kargl at gcc dot gnu.org
@ 2021-08-19 6:43 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-08-19 6:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101735
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
Keywords| |rejects-valid
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Additional example – same general issue, different error message:
character(len=5) :: str2(4)
type t
character(len=5) :: str(4)
end type t
type(t) :: var
integer :: x, y
x = var%str(:)(1:1)%len ! Bogus: 'Invalid character in name'
y = str2(:)(1:1)%len ! Bogus: 'Invalid character in name'
Plus: same issue with: % kind
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-19 6:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 21:08 [Bug fortran/101735] New: Type parameter inquiries for substrings are rejected anlauf at gcc dot gnu.org
2021-08-02 21:13 ` [Bug fortran/101735] " anlauf at gcc dot gnu.org
2021-08-02 21:35 ` kargl at gcc dot gnu.org
2021-08-19 6:43 ` burnus at gcc dot gnu.org
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).