public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/108382] New: Incorrect parsing when acc and omp coexist and -fopenmp -fopenacc is used.
@ 2023-01-12 12:41 zbigniew.piotrowski at ecmwf dot int
  2023-01-20 17:08 ` [Bug fortran/108382] [12/13 Regression] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zbigniew.piotrowski at ecmwf dot int @ 2023-01-12 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108382
           Summary: Incorrect parsing when acc and omp coexist and
                    -fopenmp -fopenacc is used.
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zbigniew.piotrowski at ecmwf dot int
  Target Milestone: ---

Created attachment 54254
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54254&action=edit
Source file with a minimal example raising an error.

Problem: parsing acc and omp directives seems to incorrectly interfere, when
line continuation is used. As a result, frontend is trying to interpret omp
directives as belonging to acc. 

1) GCC versions affected: 12.1.0 (also: Mac 12.2.0) (11.3.0 unaffected)
2) System type: both: x86_64-linux-gnu (also: aarch64-apple-darwin)
3) configure options: see below, official Ubuntu 22.04 package 
4) command line: gfortran-12  -c -fopenmp -fopenacc  yoethf.F90 (same with
gfortran-11 works fine)
5) compiler output:

yoethf.F90:76:7:

   76 | !$omp                r5alvcp, r5alscp, ralvdcp, ralsdcp, ralfdcp,
rtwat, rtice, rticecu , &
      |       1
Error: Wrong OpenACC continuation at (1): expected !$ACC, got !$OMP
yoethf.F90:75:21:

   75 | !$omp declare target(r2es, r3les, r3ies, r4les, r4ies, r5les, r5ies , &
      |                     1
Error: Syntax error in !$OMP DECLARE TARGET list at (1)
yoethf.F90:76:22:

   76 | !$omp                r5alvcp, r5alscp, ralvdcp, ralsdcp, ralfdcp,
rtwat, rtice, rticecu , &
      |                      1
Error: Unclassifiable OpenMP directive at (1)
yoethf.F90:77:7:

   77 | !$omp                rtwat_rtice_r, rtwat_rticecu_r, rkoop1, rkoop2)
      |       1
Error: Wrong OpenACC continuation at (1): expected !$ACC, got !$OMP
yoethf.F90:77:22:

   77 | !$omp                rtwat_rtice_r, rtwat_rticecu_r, rkoop1, rkoop2)
      |                      1
Error: Unclassifiable OpenMP directive at (1)

6) Workaround: replace lines:

!$acc declare copyin(r2es, r3les, r3ies, r4les, r4ies, r5les, r5ies, &
!$acc   r5alvcp, r5alscp, ralvdcp, ralsdcp, ralfdcp, rtwat, rtice, rticecu, &
!$acc   rtwat_rtice_r, rtwat_rticecu_r, rkoop1, rkoop2)

!$omp declare target(r2es, r3les, r3ies, r4les, r4ies, r5les, r5ies , &
!$omp                r5alvcp, r5alscp, ralvdcp, ralsdcp, ralfdcp, rtwat, rtice,
rticecu , &
!$omp                rtwat_rtice_r, rtwat_rticecu_r, rkoop1, rkoop2)

with:

!$acc declare copyin(r2es, r3les, r3ies, r4les, r4ies, r5les, r5ies, &
!$acc   r5alvcp, r5alscp, ralvdcp, ralsdcp, ralfdcp, rtwat, rtice, rticecu, &
!$acc   rtwat_rtice_r, rtwat_rticecu_r, rkoop1, rkoop2)

!$omp declare target(r2es, r3les, r3ies, r4les, r4ies, r5les, r5ies)
!$omp declare target(r5alvcp, r5alscp, ralvdcp, ralsdcp, ralfdcp, rtwat, rtice,
rticecu)
!$omp declare target(rtwat_rtice_r, rtwat_rticecu_r, rkoop1, rkoop2)




gfortran-12 -v
Using built-in specs.
COLLECT_GCC=gfortran-12
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
12.1.0-2ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-12
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-12-sZcx2y/gcc-12-12.1.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-sZcx2y/gcc-12-12.1.0/debian/tmp-gcn/usr
--enable-offload-defaulted --without-cuda-driver --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (Ubuntu 12.1.0-2ubuntu1~22.04)

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

end of thread, other threads:[~2024-06-20  9:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 12:41 [Bug fortran/108382] New: Incorrect parsing when acc and omp coexist and -fopenmp -fopenacc is used zbigniew.piotrowski at ecmwf dot int
2023-01-20 17:08 ` [Bug fortran/108382] [12/13 Regression] " burnus at gcc dot gnu.org
2024-01-12 10:15 ` [Bug fortran/108382] [12/13/14 " rguenth at gcc dot gnu.org
2024-01-12 22:20 ` burnus at gcc dot gnu.org
2024-06-20  9:11 ` [Bug fortran/108382] [12/13/14/15 " rguenth 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).