public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/39591] New: GOMP_loop_end illegally optmized into GOMP_loop_end_nowait
@ 2009-03-30 18:23 brian dot e dot bliss at intel dot com
2009-03-30 22:19 ` [Bug other/39591] " jakub at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: brian dot e dot bliss at intel dot com @ 2009-03-30 18:23 UTC (permalink / raw)
To: gcc-bugs
As the following example shows, this optimization cannot be performed legally
if the parallel loop spawns tasks which reference vars local to the parallel
region. Without the optimization, all tasks would be executed at the implicit
barrier at the end of the loop (where "array" is still intact) rather than the
barrier at the end of the parallel region (thread 0's stack has been popped and
"array" deallocated).
% gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /net/gnu-13/export/gnu/src/gcc/gcc/configure --enable
clocale=gnu --with-system-zlib --enable-checking=assert --with-demangler-in-ld
--enable-shared --enable-threads=posix --enable-haifa --prefix=/usr/gcc4.4
--with-local-prefix=/usr/local
Thread model: posix
gcc version 4.4.0 20090311 (experimental) [trunk revision 144788] (GCC)
% cat test.c
#include <stdlib.h>
#include <stdio.h>
#include <omp.h>
int flag = 0;
int foo(int *array)
{
int i;
printf("array = %p\n", array);
for (i = 0; i < 10; i++) {
printf("i: %d 0x%x\n", i, array[i]);
}
}
int main(int argc, char *argv[])
{
#pragma omp parallel shared(argc)
{
int array[10];
int i;
for (i = 0; i < 10; i++) {
array[i] = 0x55555555;
}
#pragma omp for schedule(dynamic)
for (i = 0; i < argc; i++)
#pragma omp task default(shared) firstprivate(i)
{
if (omp_get_thread_num() == 0) {
if (! flag) {
#pragma omp critical(cs)
foo(array);
flag = 1;
}
}
else {
sleep(1);
}
#pragma omp critical(cs)
printf("i = %d\n", i);
}
}
}
%
% gcc -fopenmp test.c
% a.out x x x
array = 0xf75bf380
i: 0 0x55555555
i: 1 0x55555555
i: 2 0x55555555
i: 3 0x1312d00
i: 4 0x55555555
i: 5 0x55555555
i: 6 0x55555555
i: 7 0xf7ffc908
i: 8 0xffffffcc
i: 9 0x804872c
i = 3
i = 2
i = 1
i = 0
% nm a.out | grep GOMP_loop
U GOMP_loop_dynamic_next@@GOMP_1.0
U GOMP_loop_dynamic_start@@GOMP_1.0
U GOMP_loop_end_nowait@@GOMP_1.0
%
--
Summary: GOMP_loop_end illegally optmized into
GOMP_loop_end_nowait
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: brian dot e dot bliss at intel dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39591
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/39591] GOMP_loop_end illegally optmized into GOMP_loop_end_nowait
2009-03-30 18:23 [Bug other/39591] New: GOMP_loop_end illegally optmized into GOMP_loop_end_nowait brian dot e dot bliss at intel dot com
@ 2009-03-30 22:19 ` jakub at gcc dot gnu dot org
2009-04-01 6:55 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-03-30 22:19 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-03-30 22:19:19
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39591
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/39591] GOMP_loop_end illegally optmized into GOMP_loop_end_nowait
2009-03-30 18:23 [Bug other/39591] New: GOMP_loop_end illegally optmized into GOMP_loop_end_nowait brian dot e dot bliss at intel dot com
2009-03-30 22:19 ` [Bug other/39591] " jakub at gcc dot gnu dot org
@ 2009-04-01 6:55 ` jakub at gcc dot gnu dot org
2009-04-01 7:06 ` jakub at gcc dot gnu dot org
2009-04-01 9:13 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-01 6:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jakub at gcc dot gnu dot org 2009-04-01 06:55 -------
Subject: Bug 39591
Author: jakub
Date: Wed Apr 1 06:54:52 2009
New Revision: 145390
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145390
Log:
PR other/39591
* omp-low.c (remove_exit_barrier): Don't optimize if there are any
addressable variables in the parallel that could go out of scope while
running queued tasks.
* testsuite/libgomp.c/pr39591-1.c: New test.
* testsuite/libgomp.c/pr39591-2.c: New test.
* testsuite/libgomp.c/pr39591-3.c: New test.
Added:
trunk/libgomp/testsuite/libgomp.c/pr39591-1.c
trunk/libgomp/testsuite/libgomp.c/pr39591-2.c
trunk/libgomp/testsuite/libgomp.c/pr39591-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/omp-low.c
trunk/libgomp/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39591
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/39591] GOMP_loop_end illegally optmized into GOMP_loop_end_nowait
2009-03-30 18:23 [Bug other/39591] New: GOMP_loop_end illegally optmized into GOMP_loop_end_nowait brian dot e dot bliss at intel dot com
2009-03-30 22:19 ` [Bug other/39591] " jakub at gcc dot gnu dot org
2009-04-01 6:55 ` jakub at gcc dot gnu dot org
@ 2009-04-01 7:06 ` jakub at gcc dot gnu dot org
2009-04-01 9:13 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-01 7:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2009-04-01 07:06 -------
Subject: Bug 39591
Author: jakub
Date: Wed Apr 1 07:06:12 2009
New Revision: 145391
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145391
Log:
PR other/39591
* omp-low.c (remove_exit_barrier): Don't optimize if there are any
addressable variables in the parallel that could go out of scope while
running queued tasks.
* testsuite/libgomp.c/pr39591-1.c: New test.
* testsuite/libgomp.c/pr39591-2.c: New test.
* testsuite/libgomp.c/pr39591-3.c: New test.
Added:
branches/gcc-4_4-branch/libgomp/testsuite/libgomp.c/pr39591-1.c
- copied unchanged from r145390,
trunk/libgomp/testsuite/libgomp.c/pr39591-1.c
branches/gcc-4_4-branch/libgomp/testsuite/libgomp.c/pr39591-2.c
- copied unchanged from r145390,
trunk/libgomp/testsuite/libgomp.c/pr39591-2.c
branches/gcc-4_4-branch/libgomp/testsuite/libgomp.c/pr39591-3.c
- copied unchanged from r145390,
trunk/libgomp/testsuite/libgomp.c/pr39591-3.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/omp-low.c
branches/gcc-4_4-branch/libgomp/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39591
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/39591] GOMP_loop_end illegally optmized into GOMP_loop_end_nowait
2009-03-30 18:23 [Bug other/39591] New: GOMP_loop_end illegally optmized into GOMP_loop_end_nowait brian dot e dot bliss at intel dot com
` (2 preceding siblings ...)
2009-04-01 7:06 ` jakub at gcc dot gnu dot org
@ 2009-04-01 9:13 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-01 9:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2009-04-01 09:13 -------
Fixed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39591
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-04-01 9:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-30 18:23 [Bug other/39591] New: GOMP_loop_end illegally optmized into GOMP_loop_end_nowait brian dot e dot bliss at intel dot com
2009-03-30 22:19 ` [Bug other/39591] " jakub at gcc dot gnu dot org
2009-04-01 6:55 ` jakub at gcc dot gnu dot org
2009-04-01 7:06 ` jakub at gcc dot gnu dot org
2009-04-01 9:13 ` jakub at gcc dot gnu dot 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).