Bug 39995 - [4.1/4.2 only] Open MP compile fails with "internal compiler error"
Summary: [4.1/4.2 only] Open MP compile fails with "internal compiler error"
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.4
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-01 18:23 UTC by M. M. Sussman
Modified: 2009-05-05 08:04 UTC (History)
1 user (show)

See Also:
Host: i486-linux-gnu
Target: i486-linux-gnu
Build: i486-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments
copy of original source code. (794 bytes, text/plain)
2009-05-01 18:26 UTC, M. M. Sussman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description M. M. Sussman 2009-05-01 18:23:42 UTC
The following error occurs on more than one system with more than one version of the compiler!

I am running Ubuntu 8.04.
The output of uname -a is:
Linux ozhp 2.6.24-23-generic #1 SMP Wed Apr 1 21:47:28 UTC 2009 i686 GNU/Linux

Command line: and its output:
\gfortran -v -fopenmp simple.f90 -o junk
Driving: gfortran -v -fopenmp simple.f90 -o junk -lgfortranbegin -lgfortran -lm -shared-libgcc
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
 /usr/lib/gcc/i486-linux-gnu/4.2.4/f951 simple.f90 -quiet -dumpbase simple.f90 -mtune=generic -auxbase simple -version -fopenmp -fstack-protector -I /usr/lib/gcc/i486-linux-gnu/4.2.4/finclude -o /tmp/ccYjCwtk.s
GNU F95 version 4.2.4 (Ubuntu 4.2.4-1ubuntu3) (i486-linux-gnu)
        compiled by GNU C version 4.2.4 (Ubuntu 4.2.4-1ubuntu3).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
simple.f90: In function ‘MAIN__’:
simple.f90:42: internal compiler error: in extract_omp_for_data, at omp-low.c:161
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.2/README.Bugs>.

The problem seems to be associated with one line in the contain-ed subroutine "display".  The offending line is noted by a comment.  The subroutine is never called.

There is just this one file, named "simple.f90".

program life
implicit none
integer, parameter :: r8=selected_real_kind(14),N=20,M=40,screen=6,esc=27
integer, parameter :: steps=1000000
logical, parameter :: doDisplay=.false.
integer :: i,j,step,neighbors,ip1,im1,jp1,jm1,numGliders
character(len=1) :: blank=' ',mark='X'
character(len=1) :: world(0:N-1,0:M-1)
integer          :: iworld(0:N-1,0:M-1)

! initialize (vector statement)
world(:,:)=blank
! set up a glider
numGliders=0
DO j=1,M-4,5
  DO i=0,N-4,5
    world(i:i+2,j-1)=mark
    world(i,j)=mark
    world(i+1,j+1)=mark
    numGliders=numGliders+1
  ENDDO
ENDDO

where(world==mark)
  iworld=1
elsewhere
  iworld=0
endwhere
  print *,'starting with ',numGliders,' gliders.'

do step=1,steps
  world=blank
  !$omp parallel do private(i,jm1,jp1,im1,ip1,neighbors)
  do j=M-1,0,-1
    jm1=modulo(j-1,M)
    jp1=modulo(j+1,M)
    do i=N-1,0,-1
      im1=modulo(i-1,N)
      ip1=modulo(i+1,N)
      
      neighbors= iworld(im1,jm1)+iworld(im1,j)+iworld(im1,jp1) &
          &    + iworld(i,jm1)  +iworld(i,jp1)                 &
          &    + iworld(ip1,jm1)+iworld(ip1,j)+iworld(ip1,jp1)
      if(iworld(i,j)==0) then
        if(neighbors==3)world(i,j)=mark
      else
        if( neighbors==2 .or. neighbors==3 )world(i,j)=mark
      endif
    enddo
  enddo
  !$omp end parallel do
  where(world==mark)
    iworld=1
  elsewhere
    iworld=0
  endwhere
enddo

  print *,'   ended with ',numGliders,' gliders after',steps,' steps.'

CONTAINS

SUBROUTINE display(A)
IMPLICIT NONE
INTEGER,INTENT(IN) :: A(:,:)
CHARACTER(LEN=40)  :: fmt
CHARACTER(LEN=1),ALLOCATABLE :: Acharac(:,:)

DO i=M,1,-1
! comment out the following statement and the program compiles
  WRITE(screen,fmt)i-1,(Acharac(i,j),j=1,N)
ENDDO

END SUBROUTINE display

end program life
Comment 1 M. M. Sussman 2009-05-01 18:26:30 UTC
Created attachment 17789 [details]
copy of original source code.
Comment 2 kargls 2009-05-01 19:29:22 UTC
(In reply to comment #1)
> Created an attachment (id=17789) [edit]
> copy of original source code.
> 

Works for me with

REMOVE:kargl[208] gfc43 --version
GNU Fortran (GCC) 4.3.3 20081120 (prerelease)
REMOVE:kargl[209] gfc4x --version
GNU Fortran (GCC) 4.5.0 20090426 (experimental) [trunk revision 140508]

What 'other versions of the compiler' does it fail with?
Comment 3 msussman@verizon.net 2009-05-01 21:39:05 UTC
Subject: Re:  Open MP compile fails with "internal
	compiler error"

On Fri, 2009-05-01 at 19:29 +0000, kargl at gcc dot gnu dot org wrote:
> 
> ------- Comment #2 from kargl at gcc dot gnu dot org  2009-05-01 19:29 -------
> (In reply to comment #1)
> > Created an attachment (id=17789)
>  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17789&action=view) [edit]
> > copy of original source code.
> > 
> 
> Works for me with
> 
> REMOVE:kargl[208] gfc43 --version
> GNU Fortran (GCC) 4.3.3 20081120 (prerelease)
> REMOVE:kargl[209] gfc4x --version
> GNU Fortran (GCC) 4.5.0 20090426 (experimental) [trunk revision 140508]
> 
> What 'other versions of the compiler' does it fail with?
> 
I am sorry, I should have specified:

gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)

This is running on a system at the Pittsburgh Supercomputer Center
(warhol.psc.edu) and I am not sure what the Linux release is.

[Please excuse me if I have responded to the wrong address, this is the
first time I have used bugzilla.]


Comment 4 kargls 2009-05-01 21:50:06 UTC
(In reply to comment #3)> 
> On Fri, 2009-05-01 at 19:29 +0000, kargl at gcc dot gnu dot org wrote:
> > 
> > > Created an attachment (id=17789) [edit]
> >  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17789&action=view)
> > > copy of original source code.
> > > 
> > 
> > Works for me with
> > 
> > REMOVE:kargl[208] gfc43 --version
> > GNU Fortran (GCC) 4.3.3 20081120 (prerelease)
> > REMOVE:kargl[209] gfc4x --version
> > GNU Fortran (GCC) 4.5.0 20090426 (experimental) [trunk revision 140508]
> > 
> > What 'other versions of the compiler' does it fail with?
> > 
> I am sorry, I should have specified:
> 
> gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)
> 
> This is running on a system at the Pittsburgh Supercomputer Center
> (warhol.psc.edu) and I am not sure what the Linux release is.

You should ask the PSC to upgrade to at least the latest 4.3.x
release and preferably to the new 4.4.0 release.  Too many bugs
and features have been added to list here.


Comment 5 Francois-Xavier Coudert 2009-05-05 08:04:40 UTC
(In reply to comment #3)
> gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)

Well, your original bugreport is with gfortran 4.2.4, but anyway: both the 4.1 and 4.2 branches have been closed, so this won't be fixed. Your option is to upgrade (which can be done locally, no need to be superuser).