Re: [PATCH] Fortran, Allow task-reduction allocatable scalars without, outer ref [PR102596]

Jerry D <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
The master branch has been updated by Jerry DeLisle <[email protected]>:

https://gcc.gnu.org/g:e53a7510be51139ff4297e65e69895a6243caa9d

commit r16-8068-ge53a7510be51139ff4297e65e69895a6243caa9d

On 3/12/26 4:52 PM, Jerry D wrote:
> Note: This is a regression fix.
> 
> The attached patch regression tested on x86_64. This one is fairly simple.
> 
> I will commit shortly.
> 
> Regards,
> 
> Jerry
> 
> fortran: Allow task-reduction allocatable scalars without
>   outer ref [PR102596]
> 
> OpenMP task reduction lowering can call gfc_omp_clause_default_ctor for
> an allocatable scalar with outer == NULL_TREE.  That is valid for scalar
> allocatables that only need fresh storage allocation and do not need a
> copied descriptor or allocatable-component walk.
> 
> The Fortran hook asserted unconditionally on outer != NULL_TREE, so
> reduction(task, +:r) with an allocatable scalar ICEd during omplower.
> 
> Fix this by requiring outer only for the cases that actually use it:
> descriptor-based allocatables and types with allocatable components.
> Keep the assertion for those cases and allow NULL outer for plain scalar
> allocatables.  Add a regression test for the allocatable task-reduction
> case.
> 
> gcc/fortran/ChangeLog:
> 
>      PR fortran/102596
>      * trans-openmp.cc (gfc_omp_clause_default_ctor): Only require an
>      outer reference when the constructor path actually uses it.
> 
> gcc/testsuite/ChangeLog:
> 
>      PR fortran/102596
>      * gfortran.dg/pr102596.f90: New test.
> 
> Signed-off-by: Christopher Albert <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.