[Bug fortran/54822] New: OpenMP - Firstprivate optional dummy arguments crash if not present

roger.ferrer at bsc dot es gcc-bugzilla@gcc.gnu.org
Fri Oct 5 09:05:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54822

             Bug #: 54822
           Summary: OpenMP - Firstprivate optional dummy arguments crash
                    if not present
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roger.ferrer@bsc.es


The following program

SUBROUTINE S(X)
    IMPLICIT NONE
    INTEGER, OPTIONAL :: X

    !$OMP TASK FIRSTPRIVATE(X)
    IF (PRESENT(X)) THEN
      X = X + 1
    END IF
    !$OMP END TASK
END SUBROUTINE S

PROGRAM MAIN
    IMPLICIT NONE
    INTERFACE
        SUBROUTINE S(X)
            IMPLICIT NONE
            INTEGER, OPTIONAL :: X
        END SUBROUTINE S
    END INTERFACE

    CALL S()
END PROGRAM MAIN

crashes at runtime using gfortran 4.7.1

$ gfortran -o bug bug.f90 -fopenmp
$ ./bug 

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7FC7C9245667
#1  0x7FC7C9245C34
#2  0x7FC7C83DE4EF
#3  0x4007B2 in s_._omp_cpyfn.1 at bug.f90:0
#4  0x7FC7C8DA2875
#5  0x40074D in s_
#6  0x40075D in MAIN__ at bug.f90:0
Violació de segment

I think that the initialization of the firstprivate X using the non-present
dummy argument X is causing the crash.



More information about the Gcc-bugs mailing list