Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Steve Kargl via Fortran
On Mon, Feb 20, 2023 at 07:56:14AM +0100, Tobias Burnus wrote: > On 17.02.23 17:27, Steve Kargl wrote: > > On Fri, Feb 17, 2023 at 12:13:52PM +0100, Tobias Burnus wrote: > > > OK for mainline? > > Short version: no. > > Would you mind to write a reasoning beyond only a single word? > > > > subrou

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Tobias Burnus
On 17.02.23 17:27, Steve Kargl wrote: On Fri, Feb 17, 2023 at 12:13:52PM +0100, Tobias Burnus wrote: OK for mainline? Short version: no. Would you mind to write a reasoning beyond only a single word? subroutine foo(n) integer :: n integer :: array(n*5) integer :: my_len ... m

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Richard Biener via Fortran
On Mon, Feb 20, 2023 at 11:05 AM Tobias Burnus wrote: > > On 17.02.23 17:27, Steve Kargl wrote: > > On Fri, Feb 17, 2023 at 12:13:52PM +0100, Tobias Burnus wrote: > >> OK for mainline? > > Short version: no. > > Would you mind to write a reasoning beyond only a single word? > > >> subroutine foo(n

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Tobias Burnus
On 20.02.23 11:41, Richard Biener wrote: Generally SAVE_EXPR is used to make sure an expression is only evaluated once. It's DECL_EXPR that ensures something is evaluated early and available. So generally "unwrapping" a SAVE_EXPR looks dangerous to me unless the SAVE_EXPR is really never necess

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Jakub Jelinek via Fortran
On Mon, Feb 20, 2023 at 12:07:43PM +0100, Tobias Burnus wrote: > As mentioned in the TODO for 'deferred', I think we really want > to have NULL as upper value for the domain for the type, but that > requires literally hundred of changes to the compiler, which > I do not want to due during Stage 4,

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Tobias Burnus
On 20.02.23 12:15, Jakub Jelinek wrote: On Mon, Feb 20, 2023 at 12:07:43PM +0100, Tobias Burnus wrote: As mentioned in the TODO for 'deferred', I think we really want to have NULL as upper value for the domain for the type, but that requires literally hundred of changes to the compiler, which I

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Jakub Jelinek via Fortran
On Mon, Feb 20, 2023 at 12:48:38PM +0100, Tobias Burnus wrote: > On 20.02.23 12:15, Jakub Jelinek wrote: > > On Mon, Feb 20, 2023 at 12:07:43PM +0100, Tobias Burnus wrote: > > > As mentioned in the TODO for 'deferred', I think we really want > > > to have NULL as upper value for the domain for the

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Richard Biener via Fortran
On Mon, Feb 20, 2023 at 12:57 PM Jakub Jelinek wrote: > > On Mon, Feb 20, 2023 at 12:48:38PM +0100, Tobias Burnus wrote: > > On 20.02.23 12:15, Jakub Jelinek wrote: > > > On Mon, Feb 20, 2023 at 12:07:43PM +0100, Tobias Burnus wrote: > > > > As mentioned in the TODO for 'deferred', I think we real

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Tobias Burnus
Hi Richard, hi all, On 20.02.23 13:46, Richard Biener wrote: + /* TODO: A more middle-end friendly alternative would be to use NULL_TREE +as upper bound and store the value, e.g. as GFC_DECL_STRING_LEN. +Caveat: this requires some cleanup throughout the code to consistently

[PATCH] Fortran: improve checking of character length specification [PR96025]

2023-02-20 Thread Harald Anlauf via Fortran
Dear all, the attached patch fixes an ICE on invalid (non-integer) specification expressions for character length in function declarations. It appears that the error handling was already in place (mostly) and we need to essentially prevent run-on errors. Regtested on x86_64-pc-linux-gnu. OK for

Re: [PATCH] Fortran: improve checking of character length specification [PR96025]

2023-02-20 Thread Thomas Koenig via Fortran
Hi Harald, the attached patch fixes an ICE on invalid (non-integer) specification expressions for character length in function declarations. It appears that the error handling was already in place (mostly) and we need to essentially prevent run-on errors. Regtested on x86_64-pc-linux-gnu. OK

Re: [Patch] Fortran: Avoid SAVE_EXPR for deferred-len char types

2023-02-20 Thread Richard Biener via Fortran
On Mon, Feb 20, 2023 at 5:23 PM Tobias Burnus wrote: > > Hi Richard, hi all, > > On 20.02.23 13:46, Richard Biener wrote: > > + /* TODO: A more middle-end friendly alternative would be to use > > NULL_TREE > > +as upper bound and store the value, e.g. as GFC_DECL_STRING_LEN. > > +