Bug 26224 - ICE in C$OMP SINGLE / END SINGLE COPYPRIVATE( ) block
Summary: ICE in C$OMP SINGLE / END SINGLE COPYPRIVATE( ) block
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2006-02-11 13:09 UTC by Magnus Johansson
Modified: 2006-02-16 23:46 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-16 16:33:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Johansson 2006-02-11 13:09:24 UTC
This can perhaps be treated as a suggestion for improvement. There are also some similarities with the 25952 report (which is also for OpenMP SINGLE).

On this code the GOMP branch sometimes reports ICE without any useful information, sometimes ICE with something helpful to the programmer.

gfortran-gomp-new -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/usr/local/gomp-new --program-suffix=-gomp-new --enable-threads=posix --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.2.0-gomp-20050608-branch 20060206 (experimental) (merged 20060206)


In the code below, KLIST is not declared, which is probably the cause of the ICE. However, if KLIST is entered last in the COPYPRIVATE statement, the compiler will more correctly report an error in the code and be more helpful to the programmer (but still report an ICE).


gfortran-gomp-new -fopenmp -g -O0 -fautomatic -Wunused -c abcdef.for
abcdef.for:0: internal compiler error: Segmentation fault
Please submit a full bug report,

      SUBROUTINE ABCDEF

      IMPLICIT DOUBLE PRECISION ( A - H, O - Z ), INTEGER ( I - N )
C
      COMMON /ZZOOPP/ MVBS1, JNBNP2, JNWBS
C$OMP THREADPRIVATE(/ZZOOPP/)
C
      COMMON /ACLST/ IOUTP( 100 ), KBSTYP( 15000 ), NBK
C
      COMMON /POIUYT_P/ IBSFFD, NTSP, IIJJKK(15000), IBKR(1000)
C$OMP THREADPRIVATE(/POIUYT_P/)
C
C$OMP SINGLE
         DO 15 IBK = 1, NBK
            IBS = IBLK( IBK )
            JBS = IBKR( IBK )
            IBKR( IBK )   = IBS
            KBSTYP( IBS ) = IIJJKK( IBS )
 15      CONTINUE
C$OMP END SINGLE COPYPRIVATE( IBKR )
C
C$OMP SINGLE
      KOUT  = 0
      JNWBS = 1
      MVBS1 = 2
C
      JNBNP2 = 0
      NTSP = 0
C$OMP END SINGLE COPYPRIVATE( JNWBS, MVBS1, JNBNP2, KLIST, NTSP )
C
      IF ( IOUTP( 3 ) .GT. IOUTP( 1 ) ) THEN
         CALL ZZZZZ4( KOUT )
C$OMP BARRIER
      END IF
C
      RETURN
      END


Change the code to:
C$OMP END SINGLE COPYPRIVATE( JNWBS, MVBS1, JNBNP2, NTSP, KLIST )
                                                            ^
                                                            |
                                                            |

and the compilation will report this:

gfortran-gomp-new -fopenmp -g -O0 -fautomatic -Wunused -c abcdef.for
 In file abcdef.for:22

*$OMP SINGLE
                                                                       1
abcdef.for:0: internal compiler error: Segmentation fault
Please submit a full bug report
Comment 1 Jakub Jelinek 2006-02-16 21:35:45 UTC
Subject: Bug 26224

Author: jakub
Date: Thu Feb 16 21:35:38 2006
New Revision: 111153

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111153
Log:
	PR fortran/26224
	* parse.c (parse_omp_do, parse_omp_structured_block): Call
	gfc_commit_symbols and gfc_warning_check.

	* gfortran.dg/gomp/pr26224.f: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/gomp/pr26224.f
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/parse.c
    trunk/gcc/testsuite/ChangeLog

Comment 2 Andrew Pinski 2006-02-16 23:46:30 UTC
Fixed.