[Bug libgomp/52348] New: [4.5/4.6] OpenMP incorrectly parallelizes loops (wrong iteration count)

2012-02-23 Thread ua_gcc_bugzi...@binary-island.eu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52348

 Bug #: 52348
   Summary: [4.5/4.6] OpenMP incorrectly parallelizes loops (wrong
iteration count)
Classification: Unclassified
   Product: gcc
   Version: 4.5.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgomp
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ua_gcc_bugzi...@binary-island.eu


Created attachment 26725
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26725
testcase with unsigned and signed integers (OpenMP >= 3.0 / < 3.0)

The attached testcase shows actually two possible bugs:

(1) Using the data type's maximum value range as the number of iterations, will
result in less iterations if and only if more than 1 thread is used. Gradually
increasing the number of threads and slowly decreasing the iteration count,
will produce the right result.

(2) Using a signed range for the loop counter (starting from the negative min
to the positive max), will not work at all. No loop iteration is done. As long
as the program is linked with openmp, this does not change. Recompiling without
openmp support, produces the right result.

This behavior has been reproduced with gcc 4.5.3, 4.6.2 and current 4.6 branch
(aka the upcoming 4.6.3). Current gcc 4.7 trunk does work partially: it
produces the right results for the unsigned range but still does not work for
the signed range. The selected target (64bit / 32bit) or optimizations (Os up
to O3) make no difference at all.

The expected output would be:

INT32_MAX: 65535 / 65535
UINT32_MAX: 65535 / 65535

The OpenMP < 3.0 part (signed integer range) works correctly with the path64
compiler and both parts also work correctly with the Intel C compiler.

All tests were performed on a x86_64 (Core i7 860) Gentoo system with glibc
2.14.1(-r2) and binutils-2.22(-r1).


[Bug libgomp/52348] [4.5/4.6/4.7] OpenMP incorrectly parallelizes loops (wrong iteration count)

2012-02-23 Thread ua_gcc_bugzi...@binary-island.eu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52348

--- Comment #1 from Matthias Dahl  2012-02-23 
09:21:51 UTC ---
Before this causes any confusion: The path64 compiler does currently only
support OpenMP up to and including 2.5. That's why I stated only the OpenMP <
3.0 part works.


[Bug libgomp/52348] OpenMP incorrectly parallelizes loops (wrong iteration count)

2012-02-23 Thread ua_gcc_bugzi...@binary-island.eu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52348

--- Comment #3 from Matthias Dahl  2012-02-23 
10:21:53 UTC ---
The warning with gcc 4.3.x is correct because of the lack of support for OpenMP
3.0. Starting with 4.4, gcc supports OpenMP 3.0 which allows unsigned iteration
variables.


[Bug libgomp/52348] [4.5/4.6/4.7] OpenMP incorrectly parallelizes loops (wrong iteration count)

2012-02-23 Thread ua_gcc_bugzi...@binary-island.eu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52348

--- Comment #5 from Matthias Dahl  2012-02-23 
10:38:51 UTC ---
I am a bit short on time, so I cannot check on the OpenMP 2.5 related matter
but closing this bug is a bit premature imho. There is still the issue with the
OpenMP 3.0 part which has been confirmed by Richard Guenther in Comment 2 btw.