[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-08-31 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #15 from Tobias Burnus  ---
(In reply to Tomáš Trnka from comment #12)
> The fix for this broke assumed length optional character arguments. I have
> noticed this on 10.2.1 20200723, which is currently used by Fedora 32.

Thanks for the report – this follow-up regression has now been fixed for
mainline (GCC 11) and on the GCC 10 branch.

→ FIXED. (Bug state actually unchanged as it wasn't reopened.)

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-08-31 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #14 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Tobias Burnus
:

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

commit r10-8691-gac4f77d2563828324bb6a4f08b52aae3410702ea
Author: Tobias Burnus 
Date:   Fri Aug 28 13:54:10 2020 +0200

Fortran: Fix absent-optional handling for nondescriptor arrays (PR94672)

gcc/fortran/ChangeLog:

PR fortran/94672
* trans-array.c (gfc_trans_g77_array): Check against the parm decl
and
set the nonparm decl used for the is-present check to NULL if
absent.

gcc/testsuite/ChangeLog:

PR fortran/94672
* gfortran.dg/optional_assumed_charlen_2.f90: New test.

(cherry picked from commit cb3c3d63315ceb4dc262e5efb83b42c73c43387d)

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-08-28 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #13 from CVS Commits  ---
The master branch has been updated by Tobias Burnus :

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

commit r11-2923-gcb3c3d63315ceb4dc262e5efb83b42c73c43387d
Author: Tobias Burnus 
Date:   Fri Aug 28 13:54:10 2020 +0200

Fortran: Fix absent-optional handling for nondescriptor arrays (PR94672)

gcc/fortran/ChangeLog:

PR fortran/94672
* trans-array.c (gfc_trans_g77_array): Check against the parm decl
and
set the nonparm decl used for the is-present check to NULL if
absent.

gcc/testsuite/ChangeLog:

PR fortran/94672
* gfortran.dg/optional_assumed_charlen_2.f90: New test.

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-08-26 Thread trnka at scm dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Tomáš Trnka  changed:

   What|Removed |Added

 CC||trnka at scm dot com

--- Comment #12 from Tomáš Trnka  ---
The fix for this broke assumed length optional character arguments. I have
noticed this on 10.2.1 20200723, which is currently used by Fedora 32.

Bisected using the following testcase:

subroutine foo (n, lVal, sVal)
   integer,   intent(in)  :: n
   logical, optional, intent(out) :: lVal(n)
   character(*),optional, intent(out) :: sVal(n)

   integer :: nFound

   nFound = 0

   if (present(lVal)) then
  nFound = nFound + 1
   end if

   if (present(sVal)) then
  nFound = nFound + 1
   end if

   write(*,*) nFound

end subroutine

Affected versions compile this to the following:

  character(kind=1)[0:D.3919][1:_sval] * restrict sval.0;
…
  if (sval.0 != 0B)
{
  ubound.2 = (integer(kind=8)) *n;
  size.3 = NON_LVALUE_EXPR ;
  size.3 = MAX_EXPR ;
  D.3917 = (bitsizetype) (sizetype) NON_LVALUE_EXPR <_sval> * 8;
  D.3918 = (sizetype) NON_LVALUE_EXPR <_sval>;
  D.3919 = size.3 + -1;
  D.3920 = ((bitsizetype) (sizetype) NON_LVALUE_EXPR <_sval> *
(bitsizetype) (sizetype) NON_LVALUE_EXPR ) * 8;
  D.3921 = (sizetype) NON_LVALUE_EXPR <_sval> * (sizetype) NON_LVALUE_EXPR
;
  sval.0 = (character(kind=1)[0:D.3919][1:_sval] * restrict) sval;
}
…
  if (sval.0 != 0B)
{
  nfound = nfound + 1;
}


The first test thus relies on an unitialized value of sval.0. If that value
happens to be zero, the actual "sval" argument will be ignored even if it is
present.

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-07-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Jakub Jelinek  changed:

   What|Removed |Added

 CC||daniel.price at monash dot edu

--- Comment #11 from Jakub Jelinek  ---
*** Bug 96277 has been marked as a duplicate of this bug. ***

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-05-12 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Tobias Burnus  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Tobias Burnus  ---
FIXED.

Thanks for the bug report!

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-05-12 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #9 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Tobias Burnus
:

https://gcc.gnu.org/g:8aeffc4c9f47dd09ccc6a82d9fae35931414eb4d

commit r10-8137-g8aeffc4c9f47dd09ccc6a82d9fae35931414eb4d
Author: Tobias Burnus 
Date:   Tue May 12 12:07:39 2020 +0200

[Fortran] Fix/modify present() handling for assumed-shape optional (PR
94672)

gcc/fortran/
2020-05-12  Tobias Burnus  

Backported from mainline
2020-05-11  Tobias Burnus  

PR fortran/94672
* trans.h (gfc_conv_expr_present): Add use_saved_decl=false
argument.
* trans-expr.c (gfc_conv_expr_present): Likewise; use DECL directly
and only if use_saved_decl is true, use the actual PARAM_DECL arg
(saved
descriptor).
* trans-array.c (gfc_trans_dummy_array_bias): Set local 'arg.0'
variable to NULL if 'arg' is not present.
* trans-openmp.c (gfc_omp_check_optional_argument): Simplify by
checking
'arg.0' instead of the true PARM_DECL.
(gfc_omp_finish_clause): Remove setting 'arg.0' to NULL.

gcc/testsuite/
2020-05-12  Tobias Burnus  

Backported from mainline
2020-05-11  Jakub Jelinek  
Tobias Burnus  

PR fortran/94672
* gfortran.dg/gomp/pr94672.f90: New.
* gfortran.dg/missing_optional_dummy_6a.f90: Update scan-tree.

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-05-11 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Tobias Burnus :

https://gcc.gnu.org/g:892c7427ee234c04852e90d9ce32913a429adf9d

commit r11-271-g892c7427ee234c04852e90d9ce32913a429adf9d
Author: Tobias Burnus 
Date:   Mon May 11 16:39:20 2020 +0200

[Fortran] Fix/modify present() handling for assumed-shape optional (PR
94672)

gcc/fortran/
2020-05-07  Tobias Burnus  

PR fortran/94672
* trans.h (gfc_conv_expr_present): Add use_saved_decl=false
argument.
* trans-expr.c (gfc_conv_expr_present): Likewise; use DECL directly
and only if use_saved_decl is true, use the actual PARAM_DECL arg
(saved
descriptor).
* trans-array.c (gfc_trans_dummy_array_bias): Set local 'arg.0'
variable to NULL if 'arg' is not present.
* trans-openmp.c (gfc_omp_check_optional_argument): Simplify by
checking
'arg.0' instead of the true PARM_DECL.
(gfc_omp_finish_clause): Remove setting 'arg.0' to NULL.

gcc/testsuite/
2020-05-07  Jakub Jelinek  
Tobias Burnus  

PR fortran/94672
* gfortran.dg/gomp/pr94672.f90: New.
* gfortran.dg/missing_optional_dummy_6a.f90: Update scan-tree.

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-05-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|10.0|10.2

--- Comment #7 from Jakub Jelinek  ---
GCC 10.1 has been released.

[Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’

2020-05-07 Thread tschwinge at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Thomas Schwinge  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |burnus at gcc dot 
gnu.org
 CC||tschwinge at gcc dot gnu.org
   Keywords||openacc
 Status|NEW |ASSIGNED

--- Comment #6 from Thomas Schwinge  ---
If I understand correctly, this is a regression caused by the recent Fortran
optional arguments changes, and also it's very much related to the other
'DECL_ARTIFICIAL' items that you're looking into, so will you please have a
look at this one, too.

I also assume it likewise applies to OpenACC, not just OpenMP.