public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/59983] New: By using -fopenmp local-variable contains wrong value
@ 2014-01-29 13:45 ktietz at gcc dot gnu.org
2014-01-29 13:51 ` [Bug libgomp/59983] " jakub at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: ktietz at gcc dot gnu.org @ 2014-01-29 13:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59983
Bug ID: 59983
Summary: By using -fopenmp local-variable contains wrong value
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: libgomp
Assignee: unassigned at gcc dot gnu.org
Reporter: ktietz at gcc dot gnu.org
CC: jakub at gcc dot gnu.org
Following sample shows that amount of lions is calculate wrong by using
-fopenmp.
#include "stdio.h"
#include <omp.h>
#include <pthread.h>
void *do_thread(void *pa)
{
int niterations = 4;
int i = 0;
pthread_self();
#pragma omp parallel for
for (i = 0; i < niterations; i++)
{
printf ("%s %d\n","ducks",i);
fflush(0);
}
printf ("%s %d\n","lions",i);
fflush(0);
return NULL;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libgomp/59983] By using -fopenmp local-variable contains wrong value
2014-01-29 13:45 [Bug libgomp/59983] New: By using -fopenmp local-variable contains wrong value ktietz at gcc dot gnu.org
@ 2014-01-29 13:51 ` jakub at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-29 13:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59983
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is just wrong testcase. Without lastprivate(i) clause the original value
of i after the parallel is undefined.
See e.g. OpenMP 3.1, in 2.5.1, page 40:
"Unless the variable is specified lastprivate on the loop construct, its value
after the loop is unspecified."
Same wording in OpenMP 4.0, in 2.6, page 51.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-29 13:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-29 13:45 [Bug libgomp/59983] New: By using -fopenmp local-variable contains wrong value ktietz at gcc dot gnu.org
2014-01-29 13:51 ` [Bug libgomp/59983] " jakub 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).