[Bug c/50675] New: master and single OpenMP constructs broken
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50675 Bug #: 50675 Summary: master and single OpenMP constructs broken Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: markflorisso...@gmail.com single and master do not work properly in loops. They are either not executed as often as they should, or the program deadlocks entirely: #include int main(int argc, char **argv) { int i; #pragma omp parallel { for (i = 0; i < 10; i++) { #pragma omp single puts("hello"); } } return 0; } This program deadlocks in gcc 4.4 and 4.6, whereas in 4.2 is is only executed 4 times (which is the number of cores on my machine). The same goes for the master construct.
[Bug c/50675] master and single OpenMP constructs broken
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50675 --- Comment #2 from markflorisson88 2011-10-09 13:46:27 UTC --- Indeed, you are right. My apologies, I should teach myself to use default(none).
[Bug c/49897] New: nesting lastprivate gives incorrect result
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49897 Summary: nesting lastprivate gives incorrect result Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: markflorisso...@gmail.com Nesting lastprivate doesn't work in gcc 4.5: the inner loop has a lastprivate variable that is then also declared lastprivate on the outer loop (otherwise there would be a race), but the result after the loop is always 0. It works fine in gcc 4.2 to 4.4. SSH [1] [10:13] ~ ➤ gcc-4.5 -v Using built-in specs. COLLECT_GCC=gcc-4.5 COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.5.1/lto-wrapper Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.1-7ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --with-plugin-ld=ld.gold --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version 4.5.1 (Ubuntu/Linaro 4.5.1-7ubuntu2) SSH [0] [10:13] ~ ➤ gcc-4.5 -g -Wall -fopenmp -lgomp testomp.c SSH [0] [10:14] ~ ➤ ./a.out x=9, y=0, sum = 450 SSH [0] [10:14] ~ ➤ cat testomp.c #include int main(void) { int i = 0, j = 0, x, y, sum = 0; x = 0; #pragma omp parallel reduction(+:sum) { #pragma omp for firstprivate(x) lastprivate(x, y) for (i = 0; i < 10; i++) { x = i; y = 0; #pragma omp parallel reduction(+:sum) { #pragma omp for firstprivate(y) lastprivate(y) for (j = 0; j < 10; j++) { y = j; sum += y; } } } } printf("x=%d, y=%d, sum = %d\n", x, y, sum); return 0; } SSH [0] [10:15] ~ ➤ gcc-4.4 -g -Wall -fopenmp -lgomp testomp.c SSH [0] [10:15] ~ ➤ ./a.out x=9, y=9, sum = 450
[Bug c/49898] New: nested reduction on #pragma omp for gives incorrect result
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49898 Summary: nested reduction on #pragma omp for gives incorrect result Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: markflorisso...@gmail.com The following example fails in gcc 4.5 but works in gcc 4.4. The inner loops has a reduction that is again a reduction in the outer loop. The result should be 450, but is always 0. If you put the reduction() clauses on the #pragma omp parallel it does work. # The code SSH [0] [10:23] ~ ➤ gcc-4.5 -g -Wall -fopenmp -lgomp testomp.c SSH [0] [10:24] ~ ➤ ./a.out sum = 0 SSH [0] [10:24] ~ ➤ gcc-4.4 -g -Wall -fopenmp -lgomp testomp.c SSH [0] [10:24] ~ ➤ ./a.out sum = 450 SSH [0] [10:24] ~ ➤ cat testomp.c #include int main(void) { int i, j, sum = 0; #pragma omp parallel { #pragma omp for reduction(+:sum) for (i = 0; i < 10; i++) { #pragma omp parallel { #pragma omp for reduction(+:sum) for (j = 0; j < 10; j++) { sum += j; } } } } printf("sum = %d\n", sum); return 0; }
[Bug middle-end/49897] [4.5/4.6/4.7 Regression] nesting lastprivate gives incorrect result
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49897 --- Comment #4 from markflorisson88 2011-07-29 16:05:50 UTC --- (In reply to comment #3) > Created attachment 24865 [details] > gcc47-pr49897.patch > > Fix. Wow, thanks a lot for the quick fix!