public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
@ 2020-04-20 14:04 gcc at abeckmann dot de
  2020-04-20 14:34 ` [Bug fortran/94672] [10 Regression] " jakub at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: gcc at abeckmann dot de @ 2020-04-20 14:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

            Bug ID: 94672
           Summary: gfortran/OpenMP chokes on PRESENT(array) despite of
                    SHARED(array): Error: ‘array’ not specified in
                    enclosing ‘parallel’
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at abeckmann dot de
  Target Milestone: ---

Created attachment 48314
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48314&action=edit
failing testcase

This is a regression in gfortran-10 (reproduced in GNU Fortran (GCC) 10.0.1
20200420 (experimental) built from git master):

gfortran-master -Wall -fopenmp -c gf10bug.f90
gf10bug.f90:10:0:

   10 |        IF (PRESENT(array)) THEN
      | 
Error: ‘array’ not specified in enclosing ‘parallel’
gf10bug.f90:10:0: Error: enclosing ‘parallel’

But 'array' *is* 'shared':
    !$OMP PARALLEL DO DEFAULT(none) SHARED(array,n) PRIVATE(i)
    DO i = 1,n
       IF (PRESENT(array)) THEN

That code is accepted by gfortran <= 9, Flang, Intel, PGI.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
@ 2020-04-20 14:34 ` jakub at gcc dot gnu.org
  2020-04-20 14:54 ` jakub at gcc dot gnu.org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-20 14:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.0
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4
     Ever confirmed|0                           |1
            Summary|gfortran/OpenMP chokes on   |[10 Regression]
                   |PRESENT(array) despite of   |gfortran/OpenMP chokes on
                   |SHARED(array): Error:       |PRESENT(array) despite of
                   |‘array’ not specified in    |SHARED(array): Error:
                   |enclosing ‘parallel’        |‘array’ not specified in
                   |                            |enclosing ‘parallel’
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2020-04-20

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r10-3735-gcb57504a550158913258e5be8ddb991376475efb

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
  2020-04-20 14:34 ` [Bug fortran/94672] [10 Regression] " jakub at gcc dot gnu.org
@ 2020-04-20 14:54 ` jakub at gcc dot gnu.org
  2020-04-20 15:12 ` jakub at gcc dot gnu.org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-20 14:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
>From quick look, seems the Fortran FE for the dummy optional argument uses
array.0, i.e. a local automatic array descriptor that is assigned if
if (array != 0B && (real(kind=4)[0:] * restrict) array->data != 0B)
something at the start of the function.
While most of the references to array are then replaced with accesses to
array.0,
the PRESENT check is done using the above condition.

So, I guess we should tweak the FE so that for the optional dummy arguments in
data sharing clauses it will add also firstprivate (array) or something similar
(if the original PARM_DECL is only used in PRESENT checks, then firstprivate is
all we need).

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
  2020-04-20 14:34 ` [Bug fortran/94672] [10 Regression] " jakub at gcc dot gnu.org
  2020-04-20 14:54 ` jakub at gcc dot gnu.org
@ 2020-04-20 15:12 ` jakub at gcc dot gnu.org
  2020-04-21 11:55 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-20 15:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, just making (some or all) optional PARM_DECLs predetermined shared (or
firstprivate) by the langhook isn't correct, because
subroutine foo (array)
  real, optional :: array(:)
  !$omp parallel default(none) ! { dg-error "enclosing" }
  if (.not.present (array)) stop 1 ! { dg-error "not specified in enclosing" }
  !$omp end parallel
end subroutine
is now correctly rejected, but used to be accepts-invalid before this change.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (2 preceding siblings ...)
  2020-04-20 15:12 ` jakub at gcc dot gnu.org
@ 2020-04-21 11:55 ` jakub at gcc dot gnu.org
  2020-04-21 12:36 ` jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-21 11:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Sorry for the wrong revision, started really with
r10-3563-g73a28634098cb1aba4a1773e62b6387af120dd9e

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (3 preceding siblings ...)
  2020-04-21 11:55 ` jakub at gcc dot gnu.org
@ 2020-04-21 12:36 ` jakub at gcc dot gnu.org
  2020-05-07 10:04 ` [Bug fortran/94672] [10/11 " tschwinge at gcc dot gnu.org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-21 12:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Further examples, one for which should be rejected:
subroutine s1 (array)
  real, optional :: array(:)
  !$omp parallel default(none)          ! { dg-error "" }
  if (.not.present (array)) stop 1      ! { dg-error "" }
  !$omp end parallel
end subroutine
subroutine s2 (arg)
  real, optional :: arg
  !$omp parallel default(none)          ! { dg-error "" }
  if (.not.present (arg)) stop 1        ! { dg-error "" }
  !$omp end parallel
end subroutine
subroutine s3 (arg)
  real, value, optional :: arg
  !$omp parallel default(none)          ! { dg-error "" }
  if (.not.present (arg)) stop 1        ! { dg-error "" }
  !$omp end parallel
end subroutine

and one that should be accepted:

subroutine s1 (array)
  real, optional :: array(:)
  !$omp parallel default(none) firstprivate (array)
  if (present (array)) array(:) = 3
  !$omp end parallel
end subroutine
subroutine s2 (array)
  real, optional :: array(:)
  !$omp parallel default(none) shared (array)
  !$omp master
  if (present (array)) array(:) = 3
  !$omp end master
  !$omp end parallel
end subroutine
subroutine s3 (array)
  real, optional :: array(:)
  !$omp parallel default(none) private (array)
  if (present (array)) array(:) = 3
  !$omp end parallel
end subroutine
subroutine s4 (arg)
  real, optional :: arg
  !$omp parallel default(none) firstprivate (arg)
  if (present (arg)) arg = 3
  !$omp end parallel
end subroutine
subroutine s5 (arg)
  real, optional :: arg
  !$omp parallel default(none) shared (arg)
  !$omp master
  if (present (arg)) arg = 3
  !$omp end master
  !$omp end parallel
end subroutine
subroutine s6 (arg)
  real, optional :: arg
  !$omp parallel default(none) private (arg)
  if (present (arg)) arg = 3
  !$omp end parallel
end subroutine
subroutine s7 (arg)
  real, value, optional :: arg
  !$omp parallel default(none) firstprivate (arg)
  if (present (arg)) arg = 3
  !$omp end parallel
end subroutine
subroutine s8 (arg)
  real, value, optional :: arg
  !$omp parallel default(none) shared (arg)
  !$omp master
  if (present (arg)) arg = 3
  !$omp end master
  !$omp end parallel
end subroutine
subroutine s9 (arg)
  real, value, optional :: arg
  !$omp parallel default(none) private (arg)
  if (present (arg)) arg = 3
  !$omp end parallel
end subroutine

etc. Note, even just adding the artificial firstprivate clause is not enough,
the data sharing on the OPTIONAL parameters doesn't work as the standard says
so.
E.g. for private clause on OPTIONAL scalar without VALUE, we set the privatized
arg to &arg.1 and then compare that in the present check against NULL (which it
always is).
The spec says:
"If a list item that appears in a directive or clause is an optional dummy
argument that is not present, the directive or clause for that list item is
ignored.
If the variable referenced inside a construct is an optional dummy argument
that is not present, any explicitly determined, implicitly determined, or
predetermined data-sharing and data-mapping attribute rules for that variable
are ignored. Otherwise, if the variable is an optional dummy argument that is
present, it is present inside the construct."

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (4 preceding siblings ...)
  2020-04-21 12:36 ` jakub at gcc dot gnu.org
@ 2020-05-07 10:04 ` tschwinge at gcc dot gnu.org
  2020-05-07 11:56 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-05-07 10:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Thomas Schwinge <tschwinge at gcc dot gnu.org> 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 <tschwinge at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (5 preceding siblings ...)
  2020-05-07 10:04 ` [Bug fortran/94672] [10/11 " tschwinge at gcc dot gnu.org
@ 2020-05-07 11:56 ` jakub at gcc dot gnu.org
  2020-05-11 14:40 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-07 11:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.0                        |10.2

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.1 has been released.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (6 preceding siblings ...)
  2020-05-07 11:56 ` jakub at gcc dot gnu.org
@ 2020-05-11 14:40 ` cvs-commit at gcc dot gnu.org
  2020-05-12 10:08 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-11 14:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

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

commit r11-271-g892c7427ee234c04852e90d9ce32913a429adf9d
Author: Tobias Burnus <tobias@codesourcery.com>
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  <tobias@codesourcery.com>

            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  <jakub@redhat.com>
                Tobias Burnus  <tobias@codesourcery.com>

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (7 preceding siblings ...)
  2020-05-11 14:40 ` cvs-commit at gcc dot gnu.org
@ 2020-05-12 10:08 ` cvs-commit at gcc dot gnu.org
  2020-05-12 10:09 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-12 10:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Tobias Burnus
<burnus@gcc.gnu.org>:

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

commit r10-8137-g8aeffc4c9f47dd09ccc6a82d9fae35931414eb4d
Author: Tobias Burnus <tobias@codesourcery.com>
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  <tobias@codesourcery.com>

            Backported from mainline
            2020-05-11  Tobias Burnus  <tobias@codesourcery.com>

            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  <tobias@codesourcery.com>

            Backported from mainline
            2020-05-11  Jakub Jelinek  <jakub@redhat.com>
                        Tobias Burnus  <tobias@codesourcery.com>

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (8 preceding siblings ...)
  2020-05-12 10:08 ` cvs-commit at gcc dot gnu.org
@ 2020-05-12 10:09 ` burnus at gcc dot gnu.org
  2020-07-22  6:58 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-05-12 10:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED.

Thanks for the bug report!

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (9 preceding siblings ...)
  2020-05-12 10:09 ` burnus at gcc dot gnu.org
@ 2020-07-22  6:58 ` jakub at gcc dot gnu.org
  2020-08-26 11:06 ` trnka at scm dot com
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-22  6:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.price at monash dot edu

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 96277 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (10 preceding siblings ...)
  2020-07-22  6:58 ` jakub at gcc dot gnu.org
@ 2020-08-26 11:06 ` trnka at scm dot com
  2020-08-28 11:54 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: trnka at scm dot com @ 2020-08-26 11:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

Tomáš Trnka <trnka at scm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trnka at scm dot com

--- Comment #12 from Tomáš Trnka <trnka at scm dot com> ---
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 <ubound.2>;
      size.3 = MAX_EXPR <size.3, 0>;
      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 <size.3>) * 8;
      D.3921 = (sizetype) NON_LVALUE_EXPR <_sval> * (sizetype) NON_LVALUE_EXPR
<size.3>;
      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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (11 preceding siblings ...)
  2020-08-26 11:06 ` trnka at scm dot com
@ 2020-08-28 11:54 ` cvs-commit at gcc dot gnu.org
  2020-08-31  6:17 ` cvs-commit at gcc dot gnu.org
  2020-08-31  6:50 ` burnus at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-28 11:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

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

commit r11-2923-gcb3c3d63315ceb4dc262e5efb83b42c73c43387d
Author: Tobias Burnus <tobias@codesourcery.com>
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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (12 preceding siblings ...)
  2020-08-28 11:54 ` cvs-commit at gcc dot gnu.org
@ 2020-08-31  6:17 ` cvs-commit at gcc dot gnu.org
  2020-08-31  6:50 ` burnus at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-31  6:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Tobias Burnus
<burnus@gcc.gnu.org>:

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

commit r10-8691-gac4f77d2563828324bb6a4f08b52aae3410702ea
Author: Tobias Burnus <tobias@codesourcery.com>
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)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug fortran/94672] [10/11 Regression] gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’
  2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
                   ` (13 preceding siblings ...)
  2020-08-31  6:17 ` cvs-commit at gcc dot gnu.org
@ 2020-08-31  6:50 ` burnus at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-08-31  6:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94672

--- Comment #15 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(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.)

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-08-31  6:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 14:04 [Bug fortran/94672] New: gfortran/OpenMP chokes on PRESENT(array) despite of SHARED(array): Error: ‘array’ not specified in enclosing ‘parallel’ gcc at abeckmann dot de
2020-04-20 14:34 ` [Bug fortran/94672] [10 Regression] " jakub at gcc dot gnu.org
2020-04-20 14:54 ` jakub at gcc dot gnu.org
2020-04-20 15:12 ` jakub at gcc dot gnu.org
2020-04-21 11:55 ` jakub at gcc dot gnu.org
2020-04-21 12:36 ` jakub at gcc dot gnu.org
2020-05-07 10:04 ` [Bug fortran/94672] [10/11 " tschwinge at gcc dot gnu.org
2020-05-07 11:56 ` jakub at gcc dot gnu.org
2020-05-11 14:40 ` cvs-commit at gcc dot gnu.org
2020-05-12 10:08 ` cvs-commit at gcc dot gnu.org
2020-05-12 10:09 ` burnus at gcc dot gnu.org
2020-07-22  6:58 ` jakub at gcc dot gnu.org
2020-08-26 11:06 ` trnka at scm dot com
2020-08-28 11:54 ` cvs-commit at gcc dot gnu.org
2020-08-31  6:17 ` cvs-commit at gcc dot gnu.org
2020-08-31  6:50 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).