[Bug fortran/106005] New: (F2023) Support for REDUCTION clause in DO CONCURRENT loop

wileamyp at outlook dot com gcc-bugzilla@gcc.gnu.org
Thu Jun 16 16:50:26 GMT 2022


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

            Bug ID: 106005
           Summary: (F2023) Support for REDUCTION clause in DO CONCURRENT
                    loop
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wileamyp at outlook dot com
  Target Milestone: ---

GFortran 12.1.0 refuses to compile the following valid code under Fortran 2023.

$ cat dc-reduce.f90

PROGRAM dcreduce
  INTEGER, PARAMETER :: n = 10
  INTEGER :: ivec(n)
  ivec = [( i, i = 1, n )]
  ival = 0
  DO CONCURRENT (i=1:n) REDUCE(+:ival)
    ival = ival + ivec(i)
  END DO
  PRINT *, ival
END PROGRAM

$ gfortran --version
GNU Fortran (Spack GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gfortran dc-reduce.f90
dc-reduce.f90:7:24:

    7 |   DO CONCURRENT (i=1:n) REDUCE(+:ival)
      |                        1
Error: Syntax error in DO statement at (1)
dc-reduce.f90:9:5:

    9 |   END DO
      |     1
Error: Expecting END PROGRAM statement at (1)

At the time of writing, only NVIDIA nvfortran compiles this successfully and
gives the correct result. Tested with nvfortran 22.5.

$ nvfortran --version

nvfortran 22.5-0 64-bit target on x86-64 Linux -tp zen2 
NVIDIA Compilers and Tools
Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.

$ nvfortran dc-reduce.f90
$ ./a.out 
           55


More information about the Gcc-bugs mailing list