public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/62010] New: OpenMP simd produces wrong results
@ 2014-08-04 13:29 alexander.grund at mailbox dot tu-dresden.de
  2014-08-04 13:34 ` [Bug fortran/62010] " alexander.grund at mailbox dot tu-dresden.de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: alexander.grund at mailbox dot tu-dresden.de @ 2014-08-04 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62010
           Summary: OpenMP simd produces wrong results
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexander.grund at mailbox dot tu-dresden.de

Created attachment 33238
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33238&action=edit
Testcase 1

Using the OpenMP 4.0 SIMD construct results in wrong calculation results in
some cases. (See testcase 1)

To reproduce: simply run:
gfortran-4.9 gfortranBug.f && ./a.out && gfortran-4.9 gfortranBug.f -fopenmp &&
./a.out

Output:
 size          12
   36.016765295885790     
 size          12
   35.454228116260587 

Expected: Same for both cases.


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

* [Bug fortran/62010] OpenMP simd produces wrong results
  2014-08-04 13:29 [Bug fortran/62010] New: OpenMP simd produces wrong results alexander.grund at mailbox dot tu-dresden.de
@ 2014-08-04 13:34 ` alexander.grund at mailbox dot tu-dresden.de
  2014-08-04 16:38 ` jakub at gcc dot gnu.org
  2014-08-04 16:48 ` alexander.grund at mailbox dot tu-dresden.de
  2 siblings, 0 replies; 4+ messages in thread
From: alexander.grund at mailbox dot tu-dresden.de @ 2014-08-04 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Alexander Grund <alexander.grund at mailbox dot tu-dresden.de> ---
Related to this: In some cases OpenMP simd crashes while that crash is fixed by
removing an unrelated piece of code. See Testcase 2.

Run with:
 gfortran-4.9 gfortranBug.f -cpp && ./a.out && gfortran-4.9 gfortranBug.f -cpp
-fopenmp && ./a.out

Output:
 size          12 x          10 x           5
  -29032800293.326649     
 size          12 x          10 x           5
   3554.0040000000376 

Expected: Same output

And to crash run with:
gfortran-4.9 gfortranBug.f -cpp -D CRASH && ./a.out && gfortran-4.9
gfortranBug.f -cpp -D CRASH -fopenmp && ./a.out

Output:
 size          12 x          10 x           5
   3840.3482323232652     
 size          12 x          10 x           5

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


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

* [Bug fortran/62010] OpenMP simd produces wrong results
  2014-08-04 13:29 [Bug fortran/62010] New: OpenMP simd produces wrong results alexander.grund at mailbox dot tu-dresden.de
  2014-08-04 13:34 ` [Bug fortran/62010] " alexander.grund at mailbox dot tu-dresden.de
@ 2014-08-04 16:38 ` jakub at gcc dot gnu.org
  2014-08-04 16:48 ` alexander.grund at mailbox dot tu-dresden.de
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-08-04 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The testcases look invalid to me.  If you make j1 private, then it is
uninitialized in the loop, so if the program doesn't crash, it is by pure luck.
The other variables listed in private clause are not used in the simd loop at
all, so it doesn't make any sense to list them there.  So, just remove all
private clauses and you should be fine.


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

* [Bug fortran/62010] OpenMP simd produces wrong results
  2014-08-04 13:29 [Bug fortran/62010] New: OpenMP simd produces wrong results alexander.grund at mailbox dot tu-dresden.de
  2014-08-04 13:34 ` [Bug fortran/62010] " alexander.grund at mailbox dot tu-dresden.de
  2014-08-04 16:38 ` jakub at gcc dot gnu.org
@ 2014-08-04 16:48 ` alexander.grund at mailbox dot tu-dresden.de
  2 siblings, 0 replies; 4+ messages in thread
From: alexander.grund at mailbox dot tu-dresden.de @ 2014-08-04 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander Grund <alexander.grund at mailbox dot tu-dresden.de> changed:

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

--- Comment #4 from Alexander Grund <alexander.grund at mailbox dot tu-dresden.de> ---
You are right. It seems i missed that when I changed the code the last time and
forgot that it is private and not firstprivate. Without that it works.

Thanks for that!


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

end of thread, other threads:[~2014-08-04 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-04 13:29 [Bug fortran/62010] New: OpenMP simd produces wrong results alexander.grund at mailbox dot tu-dresden.de
2014-08-04 13:34 ` [Bug fortran/62010] " alexander.grund at mailbox dot tu-dresden.de
2014-08-04 16:38 ` jakub at gcc dot gnu.org
2014-08-04 16:48 ` alexander.grund at mailbox dot tu-dresden.de

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