public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97977] New: Fortran deferred length strings incompatible with OMP
@ 2020-11-25  2:29 poorasmith at protonmail dot com
  2020-11-25 19:49 ` [Bug fortran/97977] " anlauf at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: poorasmith at protonmail dot com @ 2020-11-25  2:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97977
           Summary: Fortran deferred length strings incompatible with OMP
           Product: gcc
           Version: 7.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: poorasmith at protonmail dot com
  Target Milestone: ---

gfortran does not correctly handle deferred length strings in OMP loops. 
Minimal example program:

program test_OMPStr
  implicit none

  integer :: indx
  character(len=:), allocatable :: string1, string2

  !$omp parallel do default(none) &
  !$omp private(indx, string1, string2) &
  !$omp num_threads(2)
  do indx = 1, 50000
    string1 = ''
    string2 = ''
    string1 = 'abc'
    string2 = 'abc'
    if (string1 .ne. string2) then
      write(*,*) 'string mismatch on indx', indx
      stop
    end if
  end do
  !$omp end parallel do
end program test_OMPStr

This program will stop at a pseudo random index.  If num_threads(1) is used the
program works as expected.  If fixed length strings are used the program works
as expected.

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

* [Bug fortran/97977] Fortran deferred length strings incompatible with OMP
  2020-11-25  2:29 [Bug fortran/97977] New: Fortran deferred length strings incompatible with OMP poorasmith at protonmail dot com
@ 2020-11-25 19:49 ` anlauf at gcc dot gnu.org
  2021-02-24 15:57 ` burnus at gcc dot gnu.org
  2021-02-24 16:16 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-25 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |11.0
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-11-25
     Ever confirmed|0                           |1

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.

The issue occurs when assigning to at least one of string1/string2 twice.

When lifting the thread limit, I've also seen SIGSEGV.

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

* [Bug fortran/97977] Fortran deferred length strings incompatible with OMP
  2020-11-25  2:29 [Bug fortran/97977] New: Fortran deferred length strings incompatible with OMP poorasmith at protonmail dot com
  2020-11-25 19:49 ` [Bug fortran/97977] " anlauf at gcc dot gnu.org
@ 2021-02-24 15:57 ` burnus at gcc dot gnu.org
  2021-02-24 16:16 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-02-24 15:57 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
I think we had the issue in some other PR. The problem is that 'string1'
consists of two variables – 'string1' itself + a hidden variable which contains
the string length.

The hidden variable needs to get a data-sharing attribute and it gets the wrong
one. I think the same issue occurs with mapping to a target region. – Not that
trivial to fix, unfortunately :-(

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

* [Bug fortran/97977] Fortran deferred length strings incompatible with OMP
  2020-11-25  2:29 [Bug fortran/97977] New: Fortran deferred length strings incompatible with OMP poorasmith at protonmail dot com
  2020-11-25 19:49 ` [Bug fortran/97977] " anlauf at gcc dot gnu.org
  2021-02-24 15:57 ` burnus at gcc dot gnu.org
@ 2021-02-24 16:16 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-02-24 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |97084

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Found the other issue: PR97084 – I did not check whether they are identical or
only closely related, though. Hence, I mark them as depends on. Additionally,
the different subject lines makes it easier to find either.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97084
[Bug 97084] Openmp + Allocatable String Crashes

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

end of thread, other threads:[~2021-02-24 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25  2:29 [Bug fortran/97977] New: Fortran deferred length strings incompatible with OMP poorasmith at protonmail dot com
2020-11-25 19:49 ` [Bug fortran/97977] " anlauf at gcc dot gnu.org
2021-02-24 15:57 ` burnus at gcc dot gnu.org
2021-02-24 16:16 ` burnus at gcc dot gnu.org

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).