public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54822] New: OpenMP - Firstprivate optional dummy arguments crash if not present
@ 2012-10-05  9:05 roger.ferrer at bsc dot es
  2012-10-05  9:48 ` [Bug fortran/54822] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: roger.ferrer at bsc dot es @ 2012-10-05  9:05 UTC (permalink / raw)
  To: gcc-bugs


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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/54822] OpenMP - Firstprivate optional dummy arguments crash if not present
  2012-10-05  9:05 [Bug fortran/54822] New: OpenMP - Firstprivate optional dummy arguments crash if not present roger.ferrer at bsc dot es
@ 2012-10-05  9:48 ` jakub at gcc dot gnu.org
  2012-10-05  9:53 ` roger.ferrer at bsc dot es
  2014-12-09 20:16 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-05  9:48 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-05 09:47:49 UTC ---
Sure, but why do you think it is a compiler error?

The OpenMP standard says that the firstprivate private copy of the var is
initialized (for non-pointers) using intrinsic assignment, if you do
intrinsic assignment of X into some other var (Y = X), then you'll get exactly
the same segfault.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/54822] OpenMP - Firstprivate optional dummy arguments crash if not present
  2012-10-05  9:05 [Bug fortran/54822] New: OpenMP - Firstprivate optional dummy arguments crash if not present roger.ferrer at bsc dot es
  2012-10-05  9:48 ` [Bug fortran/54822] " jakub at gcc dot gnu.org
@ 2012-10-05  9:53 ` roger.ferrer at bsc dot es
  2014-12-09 20:16 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 4+ messages in thread
From: roger.ferrer at bsc dot es @ 2012-10-05  9:53 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Roger Ferrer Ibanez <roger.ferrer at bsc dot es> 2012-10-05 09:53:36 UTC ---
> The OpenMP standard says that the firstprivate private copy of the var is
> initialized (for non-pointers) using intrinsic assignment, 

Oops. I tried also with Intel Fortran and it worked and I wrongly assumed this
was OK. 

The wording of the standard clearly states that this is a problem in the code.

Sorry for the fuss.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/54822] OpenMP - Firstprivate optional dummy arguments crash if not present
  2012-10-05  9:05 [Bug fortran/54822] New: OpenMP - Firstprivate optional dummy arguments crash if not present roger.ferrer at bsc dot es
  2012-10-05  9:48 ` [Bug fortran/54822] " jakub at gcc dot gnu.org
  2012-10-05  9:53 ` roger.ferrer at bsc dot es
@ 2014-12-09 20:16 ` dominiq at lps dot ens.fr
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-12-09 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> The wording of the standard clearly states that this is a problem in the code.

Thus closing as INVALID.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-09 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-05  9:05 [Bug fortran/54822] New: OpenMP - Firstprivate optional dummy arguments crash if not present roger.ferrer at bsc dot es
2012-10-05  9:48 ` [Bug fortran/54822] " jakub at gcc dot gnu.org
2012-10-05  9:53 ` roger.ferrer at bsc dot es
2014-12-09 20:16 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).