Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-26 Thread Richard Biener via Gcc-patches
> Am 26.03.2022 um 12:28 schrieb Thomas Koenig : > > On 25.03.22 12:34, Jakub Jelinek via Fortran wrote: >> What is the behavior with a RANGE_EXPR when one has { [0..10] = ++i; >> }, is that applying the side-effects 11 times or once ? > > For side effects during the evaluation of

Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-26 Thread Thomas Koenig via Gcc-patches
On 25.03.22 12:34, Jakub Jelinek via Fortran wrote: What is the behavior with a RANGE_EXPR when one has { [0..10] = ++i; }, is that applying the side-effects 11 times or once ? For side effects during the evaluation of expression, Fortran has a clear "if you depend on it, it's your fault"

Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 01:13:06PM +0100, Richard Biener wrote: > > Also, I think typically in the Fortran FE side-effects would go into > > se.pre and se.post sequences, not into se.expr, and this routine > > doesn't emit those se.pre/se.post sequences anywhere, so presumably it > > assumes they

Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Richard Biener via Gcc-patches
On Fri, Mar 25, 2022 at 12:34 PM Jakub Jelinek wrote: > > On Fri, Mar 25, 2022 at 12:16:40PM +0100, Richard Biener wrote: > > On Fri, Mar 25, 2022 at 11:13 AM Tobias Burnus > > wrote: > > > > > > On 25.03.22 09:57, Jakub Jelinek via Fortran wrote: > > > > On the gfortran.dg/pr103691.f90

Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 12:16:40PM +0100, Richard Biener wrote: > On Fri, Mar 25, 2022 at 11:13 AM Tobias Burnus > wrote: > > > > On 25.03.22 09:57, Jakub Jelinek via Fortran wrote: > > > On the gfortran.dg/pr103691.f90 testcase the Fortran ICE emits > > >static real(kind=4) a[0] = {[0 ...

Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Richard Biener via Gcc-patches
On Fri, Mar 25, 2022 at 11:13 AM Tobias Burnus wrote: > > On 25.03.22 09:57, Jakub Jelinek via Fortran wrote: > > On the gfortran.dg/pr103691.f90 testcase the Fortran ICE emits > >static real(kind=4) a[0] = {[0 ... -1]=2.0e+0}; > > That is an invalid RANGE_EXPR where the maximum is smaller

Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Tobias Burnus
On 25.03.22 09:57, Jakub Jelinek via Fortran wrote: On the gfortran.dg/pr103691.f90 testcase the Fortran ICE emits static real(kind=4) a[0] = {[0 ... -1]=2.0e+0}; That is an invalid RANGE_EXPR where the maximum is smaller than the minimum. The following patch fixes that. If TYPE_MAX_VALUE

[PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Jakub Jelinek via Gcc-patches
Hi! On the gfortran.dg/pr103691.f90 testcase the Fortran ICE emits static real(kind=4) a[0] = {[0 ... -1]=2.0e+0}; That is an invalid RANGE_EXPR where the maximum is smaller than the minimum. The following patch fixes that. If TYPE_MAX_VALUE is smaller than TYPE_MIN_VALUE, the array is empty