Re: [PATCH 09/10] fortran: Support clobbering of variable subreferences [PR88364]

2022-09-18 Thread Mikael Morin
Le 18/09/2022 à 20:32, Harald Anlauf a écrit : Assumed shape will be on the easy side, while assumed size likely needs to be excluded for clobbering. Isn’t it the converse that is true? Assumed shape can be non-contiguous so have to be excluded, but assumed size are contiguous, so valid candi

Re: [PATCH 09/10] fortran: Support clobbering of variable subreferences [PR88364]

2022-09-18 Thread Mikael Morin
Le 18/09/2022 à 12:23, Thomas Koenig a écrit : I think some of the desired behavior can still be salvaged.  For example, for (...) clobbers for the whole array can still be generated, but not for   call foo(a(2),2) so one would have to look at the lower bound. Well, my patches were for

[PATCH v2 3/9] fortran: Move clobbers after evaluation of all arguments [PR106817]

2022-09-18 Thread Mikael Morin via Fortran
For actual arguments whose dummy is INTENT(OUT), we used to generate clobbers on them at the same time we generated the argument reference for the function call. This was wrong if for an argument coming later, the value expression was depending on the value of the just- clobbered argument, and we

[PATCH v2 6/9] fortran: Support clobbering of SAVE variables [PR87395]

2022-09-18 Thread Mikael Morin via Fortran
This is in spirit a revert of: r9-3032-gee7fb0588c6361b4d77337ab0f7527be64fcdde2 That commit added a condition to avoid generating ICE with clobbers of variables with the SAVE attribute. The test added at that point continues to pass if we remove that condition now. PR fortran/87395

[PATCH v2 4/9] fortran: Support clobbering with implicit interfaces [PR105012]

2022-09-18 Thread Mikael Morin via Fortran
From: Harald Anlauf Before procedure calls, we clobber actual arguments whose associated dummy is INTENT(OUT). This only applies to procedures with explicit interfaces, as the knowledge of the interface is necessary to know whether an argument has the INTENT(OUT) attribute. This change also ena

[PATCH v2 9/9] fortran: Support clobbering of derived types [PR41453]

2022-09-18 Thread Mikael Morin via Fortran
This is probably the most risky patch in the series. A previous version of this patch allowing all exactly matching derived types showed two regressions. One of them uncovered PR106817 for which I added a fix in this series, and for the other I have excluded types with allocatable components from

[PATCH v2 5/9] fortran: Support clobbering of reference variables [PR41453]

2022-09-18 Thread Mikael Morin via Fortran
This adds support for clobbering of variables passed by reference, when the reference is forwarded to a subroutine as actual argument whose associated dummy has the INTENT(OUT) attribute. This was explicitly disabled and enabling it seems to work, as demonstrated by the new testcase. PR fo

[PATCH v2 8/9] fortran: Support clobbering of allocatables and pointers [PR41453]

2022-09-18 Thread Mikael Morin via Fortran
This adds support for clobbering of allocatable and pointer scalar variables passed as actual argument to a subroutine when the associated dummy has the INTENT(OUT) attribute. Support was explicitly disabled, but the clobber generation code seems to support it well, as demonstrated by the newly add

[PATCH v2 7/9] fortran: Support clobbering of ASSOCIATE variables [PR87397]

2022-09-18 Thread Mikael Morin via Fortran
This is in spirit a revert of: r9-3051-gc109362313623d83fe0a5194bceaf994cf0c6ce0 That commit added a condition to avoid generating ICE with clobbers of ASSOCIATE variables. The test added at that point continues to pass if we remove that condition now. PR fortran/87397 PR fortran/

[PATCH v2 2/9] fortran: Fix invalid function decl clobber ICE [PR105012]

2022-09-18 Thread Mikael Morin via Fortran
The fortran frontend, as result symbol for a function without declared result symbol, uses the function symbol itself. This caused an invalid clobber of a function decl to be emitted, leading to an ICE, whereas the intended behaviour was to clobber the function result variable. This change fixes

[PATCH v2 0/9] fortran: clobber fixes [PR41453]

2022-09-18 Thread Mikael Morin via Fortran
Hello, this is the second version of a set of changes around the clobber we generate in the caller before a procedure call, for each actual argument whose associated dummy has the INTENT(OUT) attribute. The clobbering of partial variables (array elements, structure components) proved to be unsup

[PATCH v2 1/9] fortran: Move the clobber generation code

2022-09-18 Thread Mikael Morin via Fortran
This change inlines the clobber generation code from gfc_conv_expr_reference to the single caller from where the add_clobber flag can be true, and removes the add_clobber argument. What motivates this is the standard making the procedure call a cause for a variable to become undefined, which trans

Re: [PATCH v3 05/11] OpenMP: push attaches to end of clause list in "target" regions

2022-09-18 Thread Jakub Jelinek via Fortran
On Sun, Sep 18, 2022 at 08:10:00PM +0100, Julian Brown wrote: > I don't think any ATTACH clauses can appear during > the gimplify_adjust_omp_clause_1 walk. So, how about this? LGTM, thanks. Jakub

Re: [PATCH v3 06/11] OpenMP: Pointers and member mappings

2022-09-18 Thread Julian Brown
On Wed, 14 Sep 2022 14:53:54 +0200 Jakub Jelinek wrote: > On Tue, Sep 13, 2022 at 02:03:16PM -0700, Julian Brown wrote: > > @@ -3440,6 +3437,50 @@ gfc_trans_omp_clauses (stmtblock_t *block, > > gfc_omp_clauses *clauses, { > > if (pointer || (openacc && allocatable)) > >

Re: [PATCH v3 05/11] OpenMP: push attaches to end of clause list in "target" regions

2022-09-18 Thread Julian Brown
On Wed, 14 Sep 2022 14:44:54 +0200 Jakub Jelinek wrote: > On Tue, Sep 13, 2022 at 02:03:15PM -0700, Julian Brown wrote: > > This patch moves GOMP_MAP_ATTACH{_ZERO_LENGTH_ARRAY_SECTION} nodes > > to the end of the clause list, for offload regions. This ensures > > that when we do the attach opera

Re: [PATCH 09/10] fortran: Support clobbering of variable subreferences [PR88364]

2022-09-18 Thread Harald Anlauf via Fortran
On 18.09.22 12:23, Thomas Koenig via Gcc-patches wrote: On 18.09.22 11:10, Mikael Morin wrote: It is unfortunate as there is some desirable behavior within reach here. I think some of the desired behavior can still be salvaged.  For example, for   subroutine foo(a,n)     integer :: n    

Re: [PATCH 09/10] fortran: Support clobbering of variable subreferences [PR88364]

2022-09-18 Thread Richard Biener via Fortran
> Am 18.09.2022 um 11:10 schrieb Mikael Morin : > > Le 18/09/2022 à 08:12, Richard Biener a écrit : >>> On Sat, Sep 17, 2022 at 9:33 PM Mikael Morin wrote: >>> >>> Le 17/09/2022 à 19:03, Thomas Koenig via Fortran a écrit : I have a concern about this part, though. My understandin

Re: [PATCH 09/10] fortran: Support clobbering of variable subreferences [PR88364]

2022-09-18 Thread Thomas Koenig via Fortran
On 18.09.22 11:10, Mikael Morin wrote: Le 18/09/2022 à 08:12, Richard Biener a écrit : On Sat, Sep 17, 2022 at 9:33 PM Mikael Morin wrote: Le 17/09/2022 à 19:03, Thomas Koenig via Fortran a écrit : I have a concern about this part, though.  My understanding at the time was that it is not

Re: [PATCH 09/10] fortran: Support clobbering of variable subreferences [PR88364]

2022-09-18 Thread Mikael Morin
Le 18/09/2022 à 08:12, Richard Biener a écrit : On Sat, Sep 17, 2022 at 9:33 PM Mikael Morin wrote: Le 17/09/2022 à 19:03, Thomas Koenig via Fortran a écrit : I have a concern about this part, though. My understanding at the time was that it is not possible to clobber an individual array el