[Bug libgomp/69414] [OpenACC] "!$acc update self" does not provide expected result

2016-03-22 Thread dc-fukuoka at sgi dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69414

--- Comment #2 from Daichi Fukuoka  ---
Hi,

I confirmed that the patch had been applied into gomp-4_0-branch.
Thank you very much for fixing the issue.

Regards,
Daichi Fukuoka

[Bug libgomp/69414] [OpenACC] "!$acc update self" does not provide expected result

2016-03-21 Thread dc-fukuoka at sgi dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69414

--- Comment #1 from Daichi Fukuoka  ---
Hi,

Has anyone looked into the issue?
In our site, one user is waiting for fixing the issue.

Best regards,
Daichi Fukuoka

[Bug libgomp/69414] New: [OpenACC] "!$acc update self" does not provide expected result

2016-01-21 Thread dc-fukuoka at sgi dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69414

Bug ID: 69414
   Summary: [OpenACC] "!$acc update self" does not provide
expected result
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgomp
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dc-fukuoka at sgi dot com
CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 37418
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37418=edit
including a reproducer, test script and the patch.

To whom it may concern, 

We are using gcc/5.2.0 with OpenACC support in our system.
One user found a bug of OpenACC of gcc.
I confirmed that the bug exists in gcc/5.3.0.
Please have a look at the attached file.

=
$ cat gcc1.f90
program gcc1
  use openacc
  implicit none
  integer :: a(16)=0
  integer :: i

  !$acc enter data copyin(a)
  !$acc kernels present(a)
  !$acc loop
  do i=1,16
 a(i)=a(i)+i
  end do
  !$acc end kernels
  !$acc update self(a(7:13))
  !$acc exit data delete(a)
  write(*,'(16i3)') a(:)
end program gcc1
=

The output should be 0  0  0  0  0  0  7  8  9 10 11 12 13  0  0  0.
If gcc 5.3.0 is used, it gives 0  0  0  0  0  0  1  2  3  4  5  6  7  0  0  0.

=
$ module load gcc/5.3.0
$ gfortran -g -o gcc1.gnu -fopenacc -foffload=nvptx-none gcc1.f90
$ ./gcc1.gnu
  0  0  0  0  0  0  1  2  3  4  5  6  7  0  0  0
=

If PGI compiler 15.10 is used, it provides expected result.

=
$ module switch gcc/5.3.0 pgi/15.10
$ pgfortran -g -o gcc1.pgi -acc -ta=tesla:cc35 gcc1.f90
$ ./gcc1.pgi
  0  0  0  0  0  0  7  8  9 10 11 12 13  0  0  0
=
And then I looked into the source code libgomp/oacc-mem.c, and found that it
can be fixed by the attached patch.

=
$ module switch pgi/15.10 gcc/5.3.0.patched
$ gfortran -g -o gcc1.gnu.patched -fopenacc -foffload=nvptx-none gcc1.f90
$ ./gcc1.gnu.patched
  0  0  0  0  0  0  7  8  9 10 11 12 13  0  0  0
=

I tested several OpenACC programs with the patch, so far it works fine.
Please review the patch and let me know if the patch can be applied into our
production system or not.

Best regards,
Daichi Fukuoka