Bug 25219

Summary: [GOMP] ICE with SAVE attribute and (FIRST|LAST)PRIVATE
Product: gcc Reporter: Roger Ferrer Ibáñez <rofi>
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: aldyh, dnovillo, gcc-bugs
Priority: P3 Keywords: openmp
Version: unknown   
Target Milestone: ---   
Host: powerpc-unknown-linux-gnu Target: powerpc-unknown-linux-gnu
Build: powerpc-unknown-linux-gnu Known to work:
Known to fail: Last reconfirmed:
Attachments: Small testcase that ICEs

Description Roger Ferrer Ibáñez 2005-12-02 08:15:39 UTC
When -fopenmp is enabled, SAVE attribute causes an ICE when the entity is referenced in a FIRSTPRIVATE or LASTPRIVATE clause, e.g.:

PROGRAM p
  IMPLICIT NONE
  ! This can be SAVE :: K and gfortran will ICE too
  SAVE 
  
  INTEGER :: K, I

  K = 3
  
  ! These two can be replaced with 
  ! !$OMP PARALLEL DO LASTPRIVATE(K) and will ICE too
  !$OMP PARALLEL
    !$OMP DO LASTPRIVATE(K)
    DO I = 1, 100
     K = I
    END DO
    !$OMP END DO
  !$OMP END PARALLEL

  PRINT *, K
END PROGRAM p
Comment 1 Roger Ferrer Ibáñez 2005-12-02 08:19:45 UTC
Sorry, I got wrong when working with my test files.

With !$OMP PARALLEL DO LASTPRIVATE(K) it does not ICE.
Comment 2 Roger Ferrer Ibáñez 2005-12-02 08:21:10 UTC
Created attachment 10388 [details]
Small testcase that ICEs
Comment 3 Jakub Jelinek 2006-01-16 17:40:20 UTC
This is not Fortran specific,
int main (void)
{
  static int i;
  static int k;

  k = 3;
  #pragma omp parallel
    #pragma omp for private(i) lastprivate(k)
      for (i = 1; i <= 100; i = i + 1)
        k = i;

  __builtin_printf ("%d\n", k);
  return 0;
}

ICEs the same.  I can't reproduce this in the Fedora Core gcc though,
so I think this got fixed by
http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01192.html
Dunno about its status, Diego, was it subsummed by your
http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00668.html
patch?
Comment 4 Diego Novillo 2006-01-16 18:18:15 UTC
Subject: Re:  [GOMP] ICE with SAVE attribute and (FIRST|LAST)PRIVATE

On Monday 16 January 2006 12:40, jakub at gcc dot gnu dot org wrote:

> ICEs the same.  I can't reproduce this in the Fedora Core gcc though,
> so I think this got fixed by
> http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01192.html
> Dunno about its status, Diego, was it subsummed by your
> http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00668.html
> patch?
>
No, it's unrelated.  I've committed Aldy's patch.
Comment 5 Diego Novillo 2006-01-16 18:23:45 UTC
Fixed with http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01192.html
Comment 6 Jakub Jelinek 2006-01-17 10:56:34 UTC
Subject: Bug 25219

Author: jakub
Date: Tue Jan 17 10:56:29 2006
New Revision: 109816

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109816
Log:
	PR fortran/25219
	* testsuite/libgomp.fortran/pr25219.f90: New test.

Added:
    branches/gomp-20050608-branch/libgomp/testsuite/libgomp.fortran/pr25219.f90
Modified:
    branches/gomp-20050608-branch/libgomp/ChangeLog