This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]